Welcome Guest, Not a member yet? Register   Sign In
  Trouble with setting up CI with OSX
Posted by: El Forum - 09-01-2008, 03:27 AM - Replies (4)

[eluser]savr[/eluser]
Hey everyone. I am using a mac and I'm having some trouble with CI. I am using the PHP and Apache that came with my mac. I am using this format (without CI to see all my files) http://localhost/~name/ The reason im using this format is because I decided to put all my PHP projects in the /users/name/sites/ folder. The problem I'm having is running scripts with code igniter (using the URI format http://localhost/~name/index.php). If anyone could help me out here I would greatly appreciate it for I am excited about using CI.

Thank you guys.
-savr


  location form_fieldset
Posted by: El Forum - 09-01-2008, 03:18 AM - Replies (5)

[eluser]almarjin[/eluser]
Hi,

Does any one know where to find "form_fieldset"?

I just wanted to edit.

Thanks,


  class CI_Calendar->get_month_name() - Wrong month name for month May
Posted by: El Forum - 09-01-2008, 02:02 AM - Replies (1)

[eluser]fensen[/eluser]
Detected in CodeIgniter_1.6.3

$month_names[5] has the same value both in
month_type == 'short'
and
month_type == 'long'.

Code:
function get_month_name($month)
{
if ($this->month_type == 'short')
{
$month_names = array(
'01' => 'cal_jan',
'02' => 'cal_feb',
'03' => 'cal_mar',
'04' => 'cal_apr',
'05' => 'cal_may',
'06' => 'cal_jun',
'07' => 'cal_jul',
'08' => 'cal_aug',
'09' => 'cal_sep',
'10' => 'cal_oct',
'11' => 'cal_nov',
'12' => 'cal_dec'
);
}
else
{
$month_names = array(
'01' => 'cal_january',
'02' => 'cal_february',
'03' => 'cal_march',
'04' => 'cal_april',
'05' => 'cal_may',
'06' => 'cal_june',
'07' => 'cal_july',
'08' => 'cal_august',
'09' => 'cal_september',
'10' => 'cal_october',
'11' => 'cal_november',
'12' => 'cal_december'
);
}
...
}

According to "/language/xxx/calendar_lang.php", the long version should be 'cal_mayl' as follows:

Code:
if ($this->month_type == 'short')
{
  $month_names = array(
    ...
    '05' => 'cal_may',
    ...
  );
}
else
{
  $month_names = array(
    ...
    '05' => 'cal_mayl',
    ...
  );
}

In English it's not a problem because the name of the month "May" is the same, short or long version.

But in other languages it is an issue.

Thanks


Fabian


  $function() ?
Posted by: El Forum - 09-01-2008, 12:21 AM - Replies (4)

[eluser]Boyz26[/eluser]
Hi everyone,

Is there any way I can convert a string variable to a function?
I am storing a series of actions in the database that will be called later.

Code:
function recipe($id) {
$this->db->where('recipe_id', $id);
$query = $this->db->get('actions');
foreach($query->result() as $row):
//my question: can I do any of these?
  $actionName = $row->actionName;
  $this->$actionName();
//or..
  convertToFunction($actionName);
//or..
  if($actionName == 'fryAnEgg') { $this->fryAnEgg() }
  elseif($actionName== 'bakeCookie') { $this->bakeCookie() }
//and so on..
endforeach;
}

function fryAnEgg() {
  //complex function
}

function bakeCookie() {
//another function
}

I will be having many many actions, so I don't want to make a long elseif list..

Thank you!!


  InkType 0.4 (Saturn) Released!
Posted by: El Forum - 09-01-2008, 12:21 AM - Replies (1)

[eluser]Developer13[/eluser]
I have released an lot of bugfixes and four new language files in the latest version of InkType.

Keep in mind - this project, like any other software project, thrives off of feedback, suggestions and bug reports, so feel free to respond to this post or to participate in the support forums! Thanks!

Quick links: Download | User Guide | Support Forums

NEW LANGUAGES FILES
- Bulgarian
- Dutch
- Polish
- Romanian

BUGFIXES
- Corrected views/admin/visitors_daily.php: $visitor['visitors_page_visited']; should be $visitor['page_visited'];
- Corrected libraries/lib_paginate.php: Changed language reference from next_page and previous_page to page_next and page_previous
- Fixed language reference in pagination (page x of y is no longer hard coded)
- Fixed language reference to 'View Site' in admin header
- Fixed language references in admin post management
- Fixed language references in admin comment management
- Fixed language reference in admin login stats
- Fixed language reference in admin download stats
- Fixed language references in admin visitor stats
- Corrected a bug that prevented posts from being made @ midnight
- IFRAME was incorrectly using base_url() instead of site_url() in views/admin/posts_form.php
controllers/blog.php and controllers/page.php have improved uri handling
- Numerous minor bugs in wz_image TinyMCE image upload plugin

DATABASE CHANGES
- Added "inktype_" prefix to all database tables and adjusted models accordingly


  validation: alpha_dash but allow spaces?
Posted by: El Forum - 09-01-2008, 12:07 AM - Replies (3)

[eluser]Boyz26[/eluser]
Hi everyone,

I was trying to make a 'Display Name' input form and then validate it to make sure it only can be alpha_dash. But is there any way I can allow spaces in the form? Is there a way to add in exceptions?

Thank you!


  Tiny tweak that's saved me a lot of time
Posted by: El Forum - 08-31-2008, 11:45 PM - Replies (4)

[eluser]mattalexx[/eluser]
I extend the core controller and add a method called internal_redirect. If you only use this everywhere you are redirecting to another method within the same controller, you will make your controller a lot more portable and rename-able.

Here 'tis:

Code:
class MY_Controller extends Controller {

   function MY_Controller() {
      parent::Controller();
   }

   function internal_redirect($url) {
      redirect($this->uri->segment(1).'/'.$url);
   }

}


  How can this not work??? help!
Posted by: El Forum - 08-31-2008, 10:20 PM - Replies (27)

[eluser]Luke D.[/eluser]
Hi all

I'm new to Codeigniter but not to php, esp. php5. Whatever. I've got my codeigniter system all set up brand new with practically no changes - nothing significant, and am working on a tiny little project. I want to build a class in the library that will make a navigation menu. I'm using the url helper. Here is the code - I pulled all the complex stuff out of it, and this won't work It is in the application library folder. Problem is it isn't correctly loading the url helper I think. Any ideas? This is making me feel retarded.

Luke


class Menumaker {

function Menumaker()
{
$obj =& get_instance();
$obj->load->helper('url');
/********************************
this didn't work either:
$this->load->helper('url');
********************************/
}

function make_menu($thing, $thing2)
{
return anchor($thing, $thing2);
/********************************
this didn't work either:
return $obj->anchor($thing, $thing2);
********************************/
}
}

$test = new Menumaker();
echo $test->make_menu('please', 'work');


  Memcached Issue
Posted by: El Forum - 08-31-2008, 08:42 PM - Replies (2)

[eluser]Unknown[/eluser]
Hi,

I'm currently in the process of implementing memcached support into a Codeigniter project, and I am running into problems when caching query results that contain more than one row of data. Queries results that only contain one row of data are cached as exepected. Those that contain more than one row of data are caching empty results.

Below is the index function on the controller that allows a user to post.

Code:
function index()
{
        $username = $this->check_creds();
        
        if($username != false)
        {
            
            $memcache = new Memcache;
            $memcache->connect('127.0.0.1', 11211) or die (redirect('error', 'location'));
            
            $data['username'] = $username;
            
            $groupsKey = $username . '_groups';
            
            $data['groups'] = $memcache->get($groupsKey);
            $groups = $memcache->get($groupsKey);
            if(!$groups)
            {
                $groups = $this->friendsmodel->myGroups($username);
                $memcache->set($groupsKey, $groups, false, 3600) or die (redirect('error', 'location'));
            }
            $data['groups'] = $groups;
            
            $settingsKey = $username . '_settings';
            $settings = $memcache->get($settingsKey);
            if(!$settings)
            {
                $settings = $this->membertoolsmodel->dashboardGetSettings($username);
                $memcache->set($settingsKey, $settings, false, 3600) or die (redirect('error', 'location'));
            }
            $data['settings'] = $settings;
            $data['private'] = $settings->private_posts;
            if(isset($_SERVER['HTTP_REFERER']))
            {
                $data['referer'] = $_SERVER['HTTP_REFERER'];
            }
            
            $memcache->close();
            $this->load->view('write', $data);
        }
        else redirect('login', 'location');
}

This controller is relatively simple. If the user is logged in it starts up a new memcached instance, gets the users groups and settings via either the cache or through a query and then loads the required view. If the user is not logged in they are redirected to the login page.

The first set of data being gathered - the groups - is used to populate a drop down list in the view. This data populates fine when the cache is empty. If the cache has been set, the data is not populated in the dropdown. The data set returned contains more than one row of data. It's model function looks like this:

Code:
function myGroups($username)
    {
        $sql = "SELECT id, group_name FROM groups WHERE username = ? and status = 'Keep'";
        $query = $this->db->query($sql, array($username));
        if($query->num_rows() > 0)
        {
            return $query;
        }
        else return FALSE;
    }

The section of the view that populates the drop down is:

Code:
<?php
        echo '<select class = "sendselect" name="groups">';
        echo '<option value = "all">To Everyone</option>';
        echo '<option value = "me">To Me</option>';
        if($groups!= FALSE)
        {

            foreach($groups->result() as $group)
            {
    
                echo "<option value = \"$group->id\">To $group->group_name</option>";
    
            }
        }
        echo '</select>';?&gt;

The var_dump of the query is:

Code:
object(CI_DB_mysql_result)#19 (7) { ["conn_id"]=>  resource(30) of type (mysql link persistent) ["result_id"]=>  resource(45) of type (mysql result) ["result_array"]=>  array(0) { } ["result_object"]=>  array(0) { } ["current_row"]=>  int(0) ["num_rows"]=>  int(4) ["row_data"]=>  NULL }


The var_dump of the cache is:

Code:
object(CI_DB_mysql_result)#20 (7) { ["conn_id"]=>  int(0) ["result_id"]=>  int(0) ["result_array"]=>  array(0) { } ["result_object"]=>  array(0) { } ["current_row"]=>  int(0) ["num_rows"]=>  int(4) ["row_data"]=>  NULL }

The second set of data - settings - only contains one row of data, and is cached correctly. It's function looks like this:

Code:
function dashboardGetSettings($username)
    {
        $sql = "SELECT private_posts, notify_rss, rss_secret_word FROM settings WHERE username = ? LIMIT 1";
        $result = $this->db->query($sql, array($username));
        $row = $result->row();
        return $row;
    }


Anyone have an idea why the first result set - groups - is not being cached properly? I notice that both the query dump and the cache dump both show that the row data is NULL. I assume that this is the problem, but am unsure how to correct it.


  CodeIgniter and APC Opcode caching
Posted by: El Forum - 08-31-2008, 06:17 PM - Replies (3)

[eluser]Phil_B[/eluser]
Has anyone managed to get the opcode caching in APC working with CodeIgniter? The data storage works fine but I haven't noticed any improvement in page load times.

The apc.php overview page only lists the file path for the current controller as being cached. Whereas eAccelerator would list all of CI.

I've used eAccelerator successfully in the past and noticed huge performance boosts but it occasionally causes segmentation faults and crashes Apache.

Anyone have any experience with this?

Thanks


Welcome, Guest
You have to register before you can post on our site.

Username
  

Password
  





Latest Threads
Bug with sessions CI 4.5....
by ALTITUDE_DEV
1 hour ago
Validation | trim causes ...
by kenjis
3 hours ago
Integrating Bootstrap 5 i...
by Bosborne
4 hours ago
Error / Shield 1.0.3 + Ci...
by kenjis
5 hours ago
Asset Minification Packag...
by tarcisiodev1
Yesterday, 05:11 PM
Modify users data as an a...
by luckmoshy
Yesterday, 04:56 PM
Is it possible to go back...
by ejimenezo
Yesterday, 11:49 AM
SQL server connection not...
by davis.lasis
Yesterday, 07:11 AM
Problem with session hand...
by Julesb
Yesterday, 04:13 AM
External script access to...
by PomaryLinea
Yesterday, 03:58 AM

Forum Statistics
» Members: 85,546
» Latest member: kubet77games1
» Forum threads: 77,586
» Forum posts: 376,030

Full Statistics

Search Forums

(Advanced Search)


Theme © iAndrew 2016 - Forum software by © MyBB