Welcome to Geeklog Saturday, September 26 2020 @ 04:23 am EDT

Geeklog Forums

Busted Older Stories Block


Status: offline

squatty

Forum User
Full Member
Registered: 21/01/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?
  •  Quote

    Status: offline

    Tony

    Site Admin
    Admin
    Registered: 17/12/01
    Posts: 405
    Location:Urbandale, Iowa
    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.
     Quote

    Status: offline

    squatty

    Forum User
    Full Member
    Registered: 21/01/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?
     Quote

    Status: offline

    Tony

    Site Admin
    Admin
    Registered: 17/12/01
    Posts: 405
    Location:Urbandale, Iowa
    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.
     Quote

    lopez

    Anonymous
    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?
     Quote

    Status: offline

    Tony

    Site Admin
    Admin
    Registered: 17/12/01
    Posts: 405
    Location:Urbandale, Iowa
    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.
     Quote

    Status: offline

    squatty

    Forum User
    Full Member
    Registered: 21/01/02
    Posts: 269
    Sounds good. Thanks for your help on this one.
    In a world without walls and fences, who needs Windows and Gates?
     Quote

    Status: offline

    squatty

    Forum User
    Full Member
    Registered: 21/01/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?
     Quote

    lopez

    Anonymous
    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.
     Quote

    Status: offline

    Tony

    Site Admin
    Admin
    Registered: 17/12/01
    Posts: 405
    Location:Urbandale, Iowa
    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.
     Quote

    lopez

    Anonymous
    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.
     Quote

    lopez

    Anonymous
    Nevermind. I got it working. Thanks!
     Quote

    Status: offline

    squatty

    Forum User
    Full Member
    Registered: 21/01/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?
     Quote

    lopez

    Anonymous
    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.
     Quote

    Status: offline

    Tony

    Site Admin
    Admin
    Registered: 17/12/01
    Posts: 405
    Location:Urbandale, Iowa
    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.
     Quote

    All times are EDT. The time is now 04:23 am.

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