Topics

User Functions

Events

There are no upcoming events

What's New

Stories

No new stories

Comments last 2 weeks

No new comments

Trackbacks last 2 weeks

No new trackback comments

Links last 2 weeks

No recent new links

NEW FILES last 14 days

No new files

Welcome to Geeklog Sunday, May 19 2013 @ 03:29 AM EDT


 Forum Index > Support > General Geeklog Support New Topic Post Reply
 Busted Older Stories Block
   
squatty
 03/05/02 10:18PM (Read 1619 times)  
+++++
Full Member

Status: offline


Registered: 01/21/02
Posts: 269
For quite some time now I've been trying to get the Older Stories Block to work on my Geeklog install. My first attempt was on version 1.3, then 1.3.1, and now on 1.3.3. All attempts have failed!



My problems have all centered on the COM_olderstuff function in lib-common.php.



Thus far I've narrowed it down to two issues:

  • The select statement returns no rows. For some reason all of my stories have a draft_flag = 0 and not = 1.

  • The second problem is in the DB_delete and DB_save function calls. The SQL generated results in an error. Specifically the title value appears in double quotes, “Older Stories” and not single quotes ‘Older Stories’. This breaks the SQL statements. To fix the problem I resorted to the following hack:


    //DB_delete($_TABLES['blocks'],'title',"''");
    //DB_save($_TABLES['blocks'],'title,blockorder,content',"'','','$string'");
    DB_delete('blocks','title','Older Stories');
    DB_save('blocks','title,blockorder,content',"'Older Stories','7','$string'");


    Has anyone run across similar issues? If so how did you correct the problem?


    Thanks,
    Danny


  • In a world without walls and fences, who needs Windows and Gates?
     
    Profile Email Website
     Quote
    Tony
     03/06/02 09:47AM  
    AAAAA
    Admin

    Status: offline


    Registered: 12/17/01
    Posts: 405
    first:

    draft_flag = 0 means the story is not a draft thus it should be pulled. This is contrary to your first point.

    second:

    I have a stock 1.3.3 install on iowaoutdoors.org and the older stories block works without modification. What OS/Web Server/ and version of MySQL are you running?

    -----
    The reason people blame things on previous generations is that there's only one other choice.

    The reason people blame things on previous generations is that there's only one other choice.
     
    Profile Email Website
     Quote
    squatty
     03/06/02 11:17AM  
    +++++
    Full Member

    Status: offline


    Registered: 01/21/02
    Posts: 269
    Tony,


    The lib-common.php code included in the 1.3.3 distribution has the following SQL query in the COM_olderstuff function:



    $result = DB_query("SELECT sid,title,comments,unix_timestamp(date) AS day FROM "
    . $_TABLES['stories'] . " WHERE draft_flag = 1 ORDER BY date desc LIMIT , ");
    $nrows = DB_numRows($result);


    As I stated in the first issue, all of my stories have a draft_flag = 0. You also pointed out that this is correct. Why is the SQL looking for draft_flag = 0?



    As for my install, I am running Geeklog 1.3.3 on RedHat 7.2 with Apache 1.3.23 and PHP 4.1.1.



    Thanks,
    Danny


    In a world without walls and fences, who needs Windows and Gates?
     
    Profile Email Website
     Quote
    Tony
     03/06/02 01:11PM  
    AAAAA
    Admin

    Status: offline


    Registered: 12/17/01
    Posts: 405
    The code for the block sux (legacy 1.1 code). It should not delete the block at all. Instead it should do a UPDATE statement. This could one of the reasons why the bid in the block table is so fubar'd.

    Let me hack at it a bit and I'll post the code fix here.

    -----
    The reason people blame things on previous generations is that there's only one other choice.

    The reason people blame things on previous generations is that there's only one other choice.
     
    Profile Email Website
     Quote
    lopez
     03/06/02 01:25PM  
    +----
    Newbie

    Status: offline


    Registered: 03/04/02
    Posts: 8
    Do you set it up as a PHP Block? COM_olderstuff doesn't return anything,
    so I don't think that will work. Is there a simple step-by-step procedure
    for turning Older Stories on?

     
    Profile Email
     Quote
    Tony
     03/06/02 01:41PM  
    AAAAA
    Admin

    Status: offline


    Registered: 12/17/01
    Posts: 405
    Replace your COM_olderstuff() with this.

    -----

    The reason people blame things on previous generations is that there's only one other choice.


    The reason people blame things on previous generations is that there's only one other choice.
     
    Profile Email Website
     Quote
    squatty
     03/06/02 01:51PM  
    +++++
    Full Member

    Status: offline


    Registered: 01/21/02
    Posts: 269
    Sounds good. Thanks for your help on this one.

    In a world without walls and fences, who needs Windows and Gates?
     
    Profile Email Website
     Quote
    squatty
     03/06/02 02:01PM  
    +++++
    Full Member

    Status: offline


    Registered: 01/21/02
    Posts: 269
    You don't. All you do is set the following value in your config.php file to 1:



    $_CONF['olderstuff'] = 1; //1 = on 0= off


    The block is created for you. The code for the block is in lib-common.php.


    In a world without walls and fences, who needs Windows and Gates?
     
    Profile Email Website
     Quote
    lopez
     03/06/02 02:17PM  
    +----
    Newbie

    Status: offline


    Registered: 03/04/02
    Posts: 8
    Hmm. I just applied this fix, and it made no difference.

    olderstuff is set to 1 in my config.php.

    I still don't see the block on my site.

     
    Profile Email
     Quote
    Tony
     03/06/02 02:23PM  
    AAAAA
    Admin

    Status: offline


    Registered: 12/17/01
    Posts: 405
    Well, another detail of this is you will need to edit an article and save it without making the changes. This will force the COM_olderstuff block to run.

    Also, make sure you didn't deselect the block in you Display Preferences. Finally, ensure you have a block in your system with the name 'older_stories'. As long as you have all that it should work.

    -----
    The reason people blame things on previous generations is that there's only one other choice.

    The reason people blame things on previous generations is that there's only one other choice.
     
    Profile Email Website
     Quote
    lopez
     03/06/02 02:26PM  
    +----
    Newbie

    Status: offline


    Registered: 03/04/02
    Posts: 8
    Ah. Okay. I don't have a block named "older_stories" in my system. If I
    add it, what do I add for content? It won't accept a block without
    content.

     
    Profile Email
     Quote
    lopez
     03/06/02 02:29PM  
    +----
    Newbie

    Status: offline


    Registered: 03/04/02
    Posts: 8
    Nevermind. I got it working. Thanks!

     
    Profile Email
     Quote
    squatty
     03/06/02 02:32PM  
    +++++
    Full Member

    Status: offline


    Registered: 01/21/02
    Posts: 269
    Did you just add a normal block named Older Stories and then hit your site? I don't seem to be getting updates even after re-saving a new story. For example, delete the content of your Older Stories block (after it has been created). Then hit your site. The bock should re-create itself. Right?

    In a world without walls and fences, who needs Windows and Gates?
     
    Profile Email Website
     Quote
    lopez
     03/06/02 02:46PM  
    +----
    Newbie

    Status: offline


    Registered: 03/04/02
    Posts: 8
    Well, I just put some bogus content in there. Specifically, I created a
    Normal Block, named it older_stories and put "Nothing to see here" in
    the content field.

    Then I edited an article and re-saved it. Hey, presto! The block started
    working.

    Sort of.

    I just noticed that it only contains some of my older articles. Specifically
    starting with Monday and going backwards. This would make sense if it
    decides an "old" story is at least 48 hours old, but I can't see anything in
    COM_olderstuff to back that claim up.

     
    Profile Email
     Quote
    Tony
     03/07/02 07:16AM  
    AAAAA
    Admin

    Status: offline


    Registered: 12/17/01
    Posts: 405
    No, only when you save a story does the older_stories block get generated (which makes sense). This prevents us from executing SQL for every page request when it is only needed when stories are added, changed or deleted.

    -----
    The reason people blame things on previous generations is that there's only one other choice.

    The reason people blame things on previous generations is that there's only one other choice.
     
    Profile Email Website
     Quote
    Content generated in: 0.58 seconds
    New Topic Post Reply

    Normal Topic Normal Topic
    Sticky Topic Sticky Topic
    Locked Topic Locked Topic
    New Post New Post
    Sticky Topic W/ New Post Sticky Topic W/ New Post
    Locked Topic W/ New Post Locked Topic W/ New Post
    View Anonymous Posts 
    Able to post 
    Filtered HTML Allowed 
    Censored Content