SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Addict ruba's Avatar
    Join Date
    Apr 2005
    Location
    Amman -Jordan
    Posts
    339
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Codeigniter Loader

    Hi every body ,

    I have problem in codeigniter ,
    I want to create article view counter, I create update query in the model to increment number of visitor +1 ..
    when I run the code, the codeigniter run the query 3 times
    I run the log file in the config, it show me "Final output sent to browser" run 3 times

    what's happens and what should I do to run the code once

    I will be very thanks full for any help
    Open Blocked website
    Open Blocked Website
    Knowledge Is Knowing That A Tomato Is A Fruit,
    Wisdom Is Not Putting It In A Fruit Salad.

  2. #2
    Patience... bronze trophy solidcodes's Avatar
    Join Date
    Jul 2006
    Location
    Philippines
    Posts
    936
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Can you post the controller, model and view codes here.
    Quality codes are optimized and tested...
    Click here for inspiration..

  3. #3
    SitePoint Addict ruba's Avatar
    Join Date
    Apr 2005
    Location
    Amman -Jordan
    Posts
    339
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    $this->db->where('id', $c_id);
    $this->db->set('no_views', '`no_views` + 1', FALSE);
    $this->db->update('tabel');
    this code for increment number of views,
    i try put this code in model and controller and view but the problem not increment 1 Codeigniter increment +3 for each view
    when i make debug for Codeigniter, i found the Codeigniter run the site three times...
    how i can make Codeigniter run the code only one time
    Open Blocked website
    Open Blocked Website
    Knowledge Is Knowing That A Tomato Is A Fruit,
    Wisdom Is Not Putting It In A Fruit Salad.

  4. #4
    SitePoint Mentor bronze trophy
    John_Betong's Avatar
    Join Date
    Aug 2005
    Location
    City of Angels
    Posts
    1,826
    Mentioned
    73 Post(s)
    Tagged
    6 Thread(s)
    Take a look at this thread:

    http://ellislab.com/forums/viewthread/133829/#660729

    The problem was solved due to a missing favicon.ico in the CSS file,

    Try remming large blocks of your view using the following and test each removal to see if the problem is eliminated:

    Code:
    <?php if(false) { /* rem following script fragment */ ?>
      <!doctype html>
      <html>
      <head>
    ...
    ...
      </head>
    <?php };?>
    
    <body>
    ...
    </body>
    </html>

  5. #5
    SitePoint Addict ruba's Avatar
    Join Date
    Apr 2005
    Location
    Amman -Jordan
    Posts
    339
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i don`t think related with css the problem from codeignitor is run the code three times but display one time
    Open Blocked website
    Open Blocked Website
    Knowledge Is Knowing That A Tomato Is A Fruit,
    Wisdom Is Not Putting It In A Fruit Salad.

  6. #6
    SitePoint Mentor bronze trophy
    John_Betong's Avatar
    Join Date
    Aug 2005
    Location
    City of Angels
    Posts
    1,826
    Mentioned
    73 Post(s)
    Tagged
    6 Thread(s)
    Did you read the thread that I supplied?

    Using .htaccess?
    Browser requests for missing asset files will be passed back to your application.

    Let me restate wiredesignz: Browser requests for missing asset files will be passed back to your application.
    >>> Have you looked for such a thing yet. No need to dive into code before doing this.
    View with FireFox, browse source and try opening all the CSS, javascript and any other included files such as images. If the file will not open because it is missing then the browser will return with an error to the .htaccess file again causing the code to run again.

    Try renaming your .htaccess file and see if the problem persists.

    I would put my money on a missing file

  7. #7
    SitePoint Addict ruba's Avatar
    Join Date
    Apr 2005
    Location
    Amman -Jordan
    Posts
    339
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    my htaccess
    Code:
    Options +FollowSymLinks -MultiViews
    # Turn mod_rewrite on
    RewriteEngine On
    RewriteBase /
    
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ /index.php/$1 [L,QSA]
    
    RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s(.*)/index\.php [NC]
    RewriteRule ^ %1 [R=301,L]
    
    ErrorDocument 403 /404
    ErrorDocument 500 /404
    and i try with empty htaccess is give me same result

    and no warning for any file missing
    Open Blocked website
    Open Blocked Website
    Knowledge Is Knowing That A Tomato Is A Fruit,
    Wisdom Is Not Putting It In A Fruit Salad.

  8. #8
    SitePoint Mentor bronze trophy
    John_Betong's Avatar
    Join Date
    Aug 2005
    Location
    City of Angels
    Posts
    1,826
    Mentioned
    73 Post(s)
    Tagged
    6 Thread(s)
    Is the page online, if not can you upload the page and supply the link.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •