Welcome Guest, Not a member yet? Register   Sign In
  Using the scaffolding tool when $config['uri_protocol'] ='QUERY_STRING'
Posted by: El Forum - 11-12-2008, 10:36 PM - No Replies

[eluser]Unknown[/eluser]
Does anyone know how to call the scaffolding tool when $config['uri_protocol'] = 'QUERY_STRING' in the config.php file in the system/aplication/config folder

questnew


  Planning a rejuvination of CodeExtinguisher...interested?
Posted by: El Forum - 11-12-2008, 08:33 PM - Replies (47)

[eluser]Majd Taby[/eluser]
Hey Guys,
I've been dormant for quite a few months now, CodeExtinguisher development has stopped in that time. If you're interested, here's what happened, otherwise, skip this paragraph:

Over the summer, I got burnt-out. I had been developing codex alone (with help from Thoer) for more than a year, and I just needed some time off. Then school started, and it's been one hell of a semester....not hell as in a good hell, i mean, burning hell.

In any case, the semester is 3 weeks from being over and I want to restart the project. There are a lot of things i want to add, a lot of things that need to be pruned, a lot of things that need to fixed, and a lot...lot of documentation to write.

A lot of the code that runs codex is legacy code. It was written before I knew codex will grow this large, or will be used by this many people. That code will need to be re-written.

A lot of code was written without proper thought and design...as a result, the project fails to scale well to heavy websites.

The documentation is nowhere to be found, and the examples I admit, might be kind of confusing, that needs to be fixed.

There's no consolidation of codex assets: screencasts are somewhere, docs are somewhere, zips are somewhere, and it's a mess...so I'm working on a website.

There's not enough emphasis on 3rd party development, that as well needs to be fixed, and will be addressed with the new website.

Now, this is where you guys can get involved. I outlined _some_ of the problems of codeextinguisher, there are a lot more. What I will do in the short term is draft a document that outlines the vision, purpose, guidelines, and standards for CodeExtinguisher. I will draft programming guidelines, standards, and conventions etc.

You can help me in a variety of ways:

1) If you have a suggestion, please let me know.
2) If you would like to help with the documentation, please contact me, and I will add you as a writer to the wiki
3) If you would like to help me develop codeextinguisher, please contact me and I will add you to the subversion repository so you can help us develop.

As you guys might know, CodeExtinguisher is free, open-source software. You can do with it whatever you want, as long as you provide acknowledgement. As a result, I won't be able to provide you with any monetary payments. I build CodeExtingiusher for two main reasons: It's fun, and it bolsters my resume. Hopefully you will see both benefits and decide to help me.

As I said, this is still very much in the planning stages, I want to get a feel for the kind of interest, and any ideas. I feel like CodeExtinguisher has achieved a certain level of ubiquity and recognition, and thus see a lot of promise in it.


Take car,
Majd Taby


  uri segment vs form GET uri into same controller...?
Posted by: El Forum - 11-12-2008, 08:14 PM - Replies (2)

[eluser]steward[/eluser]
Say I am looking at page 3 of some result set.
So the next/prev page links are :

mysite.com/index.php/video/browse/page/2
mysite.com/index.php/video/browse/page/4

In the page navigation bar, I have a "jump to page" field.
Suppose the user types in 87 and clicks the jump button.

This will generate a GET request something like:

mysite.com/index.php/video/browse?page=87

But what I need now is

mysite.com/index.php/video/browse/page/87

I can invent solutions, but this must be a common/easy problem
(he says hopefully).

How does a controller distinguish between these two equivalent entry points?
Noob here. Which part of the manual do I need to re-read?


  Write into a file
Posted by: El Forum - 11-12-2008, 06:54 PM - Replies (1)

[eluser]Lazos[/eluser]
I read the guide about writing into a file but I am not sure about something that I read in the documentation of PHP.

w+ - "Open for reading and writing; place the file pointer at the beginning of the file and truncate the file to zero length. If the file does not exist, attempt to create it."


If I use w+b for my file I can write and in addition it will erase all the data inside?

Actually this is what I want just the phrase truncate the file to zero length means delete all the previous data?


  good pay template site?
Posted by: El Forum - 11-12-2008, 05:27 PM - Replies (6)

[eluser]edwardmolasses[/eluser]
hi everyone,

I'm developing a site that needs multiple templates and was just wondering if anyone had any recommendations for sites that offer templates to purchase?

I looked some up and found a bunch that use only tables :bug: or they are too small. I need some where the css is pretty flexible and stable.

thanks!

andrew.


  Problem with file upload on edit page
Posted by: El Forum - 11-12-2008, 04:40 PM - Replies (4)

[eluser]opel[/eluser]
I have been working on a cms for a small site and having a problem with the edit page and file upload.

My edit page shows the currently uploaded file and option to upload a new file. THe problem occurs if I submit an edit page without a putting a new file in the "file" field as it tried to do the upload in the model even though I have put if not null. My code is below, could anyone advise where I am going wrong please ?

THanks

Code:
function update()
    {    
    

    
      $content = array('title' => $_POST['title'],
                      'category' => $_POST['category'],
                    'description' => $_POST['description'],
                  'order' => $_POST['order']);
    
    if ($_FILES['myfile'] != NULL)
    {
        $config['upload_path'] = './includes/uploads/';
        $config['allowed_types'] = 'gif|jpg';
        $config['max_size'] = '1000';
        $config['remove_spaces'] = true;
        $config['overwrite'] = true;
        //$config['max_width']  = '400';
        //$config['max_height']  = '400';
        $this->load->library('upload', $config);    
        
        if( ! $this->upload->do_upload('myfile'))
        {
            echo $this->upload->display_errors();
            exit();
        } else
        {
        
            // Thumbnail
            $data = array('upload_data' => $this->upload->data());
          $temp=$this->upload->data();
          
          $thumb['image_library'] = 'GD2';
          $thumb['source_image'] = './includes/uploads/'.$temp['file_name'];
          $thumb['new_image'] = './includes/uploads/thumb/'.$temp['file_name'];
          $thumb['maintain_ratio'] = TRUE;
          $thumb['create_thumb'] = TRUE;
          $thumb['quality'] = '100';
          $thumb['height'] = '80';
          $thumb['width'] = '80';
      
          $this->load->library('image_lib', $thumb);
          $this->image_lib->resize();
          
           //making a thumbnail
            $this->image_lib->clear();
            
            //insert to the DB


            $content['file'] = $temp['file_name'];


        }

        $this->db->where('id', $_POST['id']);
        $this->db->update($this->table, $content);
      }


    }


  Pagination: or Why does AR class reset the query?
Posted by: El Forum - 11-12-2008, 04:15 PM - Replies (2)

[eluser]steward[/eluser]
Suppose I build a complex SQL SELECT from a search form.

I will need to call db->count_all_results() so I have that value for pagination.
I will also need to get the results db->get().

Using either of these methods resets the query. So it must be constructed again.

Okay, I'll create a function to build the query:

Code:
constructQuery($args); // set up joins, selects, conditions etc
  $data['count'] = $db->count_all_records();
  constructQuery($args);
  $data['query'] = $db->get();

Seems to me the database might have an option NOT to reset the query after a count.
Or. I am way out in left field. Maybe I should not be using the AR class.
Which kinda makes sense, as there is no "active" record, this is a search/browse.

The context of this question is pagination. I am porting from a different system which sent the query directly into the pagination system as a last step. The queries (count and get) actually took place in the pagination class.

The pagination I wish to use is different from CI as it provides more info, and allows the user to enter a page number (jump to page). That may simply be my issue.

Noob here. Any comments?


  Am i coding the/a right way ?
Posted by: El Forum - 11-12-2008, 04:08 PM - No Replies

[eluser]___seb[/eluser]
Hi,

because i'm not familiar with CI (neither any framework, MVC and object style), I don't know if i code the right way.
Here is the i made to test CI. Note that the templates caching (smarty) is not yet used.

this code uses datamapper.
What does it do :
- display bookmarks related to tag in the url (requested)
+ a list of subtags (tags associated with the found links) (less bookmarks)
+ links to the bookmarks, each without one of the found tags. (more bookmarks)
model : nothing special

Code:
class Bookmark extends DataMapper
{
    var $has_many = array('tag');

    function Bookmark()
    {
        parent::DataMapper();
    }

}

Controler : (file attached)
Code:
define('SEPARATEUR','~');
define('ITEMS_PER_PAGE',10);

class Bookmark_ctrl extends Controller
{

    /**
    * Constructor
    */
    function Bookmark_ctrl() // constructeur : appellé a chaque fois
    {
        parent::Controller();
        $this->load->model('Bookmark');
        $this->load->model('Tag');
        $this->load->library('smarty_ci');
    }
    
    /**
    * Actions
    */
    function index($tags_inline = false, $page = 1) // appellé si pas d'action de définie
    {
        $CI =& get_instance();
        $base_url = dirname($CI->config->system_url()).'/';

        $requested_tags_array = array();        // array of tags requested in url     [string]
        $requested_tags_found_array = array();    // array of tags requested in url that exist in db  [id => int] [tag => string]
        $requested_tags_found_array_flat = array();    // array of tags requested in url that exist in db  [id => int] [tag => string]
        $requested_tags_with_links = array();
        $requested_tags_not_found_array = array();    // array of tags requested in url that do not exist in db     [string]
        $requested_tags_found_str = '';        // string of requested tags'id     | ('1,6,9...')

        $requested_tags_array = $this->_get_request_tags(&$tags_inline);
        $this->_filter_requested_tags(    $requested_tags_array,
                        &$requested_tags_found_array,
                        &$requested_tags_not_found_array,
                        &$requested_tags_found_array_flat);
        unset($requested_tags_array, $inline);
        

        $bookmark = new bookmark();
        $bookmarks = array();
        $bookmarks_out = array();


        // --- the bookmarks ---

        if(empty($requested_tags_found_array)) // no requested tags found
        {
            $bookmarks = $bookmark->limit(ITEMS_PER_PAGE)->get()->all;
        }
        else
        {
            $bookmarks_ids_array = $this->_get_booksmarks_ids_by_tags($requested_tags_found_array);
            $bookmarks = $bookmark->where_in('id',$bookmarks_ids_array)->get()->all;
        }
        // out as array
        $bookmark_fields = $this->db->list_fields('bookmarks');
        foreach($bookmarks as $bookmark_obj)
        {
            $array = array();
            foreach($bookmark_obj as $k => $v)
            {
                if(in_array($k, $bookmark_fields))
                    $array[$k] = $v; //array
            }
            // add its tags
            $tags = $bookmark_obj->tag->get()->all;
            $tags_out = array();
// ---------------
            foreach($tags as $tag_obj)
            {
                $tags_out[] = array('id' => $tag_obj->id , 'tag' => $tag_obj->tag, 'url' => $this->make_link_refine( $tag_obj->tag , $requested_tags_found_array_flat) );
            }
            $array['tags'] = $tags_out;
// ---------------
            $bookmarks_out[] = $array; //array('id' => $bookmark_obj->id , 'url' => $bookmark_obj->url  );
        }


        // --- (bookmarks) related tags ---

        $tag = new tag();
        $tags = array();
        $tags_out = array();

        
        if(empty($requested_tags_found_array))
        {
            $tags = $tag->get()->all;
        }
        else
        {
            $tags_ids_array = $this->_get_tags_ids_by_bookmarks($bookmarks_ids_array);
            $tags = $tag->where_in('id',$tags_ids_array)->get()->all;
        }

        // add url to tags
        $tags_out = array();
        foreach($tags as $tag_obj)
        {
            $tags_out[] = array('id' => $tag_obj->id , 'tag' => $tag_obj->tag, 'url' => $this->make_link_refine( $tag_obj->tag , $requested_tags_found_array_flat) );
        }

        // --- requested tags with link to remove them ---
        foreach($requested_tags_found_array_flat as $tag)
            $requested_tags_with_links[] = array('tag' => $tag, 'url' => $this->make_link_enlarge( $tag , $requested_tags_found_array_flat) );

        $this->smarty_ci->assign('tags',$tags_out);
        $this->smarty_ci->assign('bookmarks',$bookmarks_out);
        $this->smarty_ci->assign('requested_tags',$requested_tags_with_links);

        $this->smarty_ci->display('base.tpl');
        $this->output->enable_profiler(TRUE);

    }

    /**
    * privates functions
    */

    /**
    * array of requested tags (requested by url)
    * @param string tags in url ( 'tag1SEPARATEURtag2SEPARATEURtag3' => tag1~tag2~tag3 )
    * @return array ( 'tag1', 'tag2', ... )
    * @version 0.1
    */
    private function _get_request_tags(&$tags_inline)
    {
        $tags_inline = trim ( $tags_inline, SEPARATEUR );
        $requested_tags_array = explode(SEPARATEUR ,$tags_inline);
        return array_unique($requested_tags_array);
    }

// other functions removed because of message size limit, files attached
}


  forc_download() at a wite space at the begining of file content
Posted by: El Forum - 11-12-2008, 04:05 PM - No Replies

[eluser]Amir Bukhari[/eluser]

Code:
$file = $media->filepath;
$data = file_get_contents(SITE_BASE.$file);
            
force_download("media_file_$id.rm", $data);

the file got download correctly and it is a RM file.

but real player can not open it. then i figured there is a white space at the begining of the file, which is not part of the content. after removing the that white space realplayer can play the file.

if any of PHP file include a white space then header() function should complain about it.

any help?


  HMVC vs MVC
Posted by: El Forum - 11-12-2008, 03:02 PM - No Replies

[eluser]al404[/eluser]
i'm new at CI and at MVC, but while i was reading trying to figure out my default best dir structure: a structure that will let me easyly re-use some part of my web site for next projects

i found out HMVC, but is not clear to me if is usefull only for very big project, mine could be between 20 and 30 standard PHP pages, but some times can growe... of course never now in advance :-D

so i was wondering is HMVC is usefull for me?


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

Username
  

Password
  





Latest Threads
Array to HTML "Table"
by paulkd
5 hours ago
TypeError when trying to ...
by b126
6 hours ago
Webhooks and WebSockets
by InsiteFX
Yesterday, 10:39 AM
Retaining search variable...
by pchriley
Yesterday, 05:46 AM
Reading a session variabl...
by xanabobana
Yesterday, 05:05 AM
Update to v4.5.1, same us...
by kenjis
04-17-2024, 07:47 PM
Codeigniter 4 extend core...
by Semsion
04-17-2024, 05:08 AM
v4.5.1 Bug Fix Released
by lokman
04-16-2024, 02:12 PM
problem with textarea
by Nitin Arora
04-16-2024, 05:07 AM
Showing pdf on browser
by aarefi
04-16-2024, 04:38 AM

Forum Statistics
» Members: 84,559
» Latest member: BK8Brasil
» Forum threads: 77,558
» Forum posts: 375,896

Full Statistics

Search Forums

(Advanced Search)


Theme © iAndrew 2016 - Forum software by © MyBB