Welcome to Geeklog Sunday, October 24 2021 @ 01:59 pm EDT

Geeklog Forums

Title of stories in the What's New Block


Status: offline

willyfi

Forum User
Newbie
Registered: 04/01/05
Posts: 12
Hi.
I wish to show the title of the new stories in the What's New block, in the same way it is done for links and comments. Currently only it's showed the number of new stories in the last X hours, but not the titles of these stories. Is it possible? Anyone know how can it be done?

Sorry for my horrible English. Embarassed
 Quote

sammykrupa

Anonymous
I don't know how it can be done but your English is better then half the people here Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy
 Quote

Status: offline

willyfi

Forum User
Newbie
Registered: 04/01/05
Posts: 12
Nobody can help me? Can someone help me
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 12/01/02
Posts: 13073
Location:Stuttgart, Germany
It's not supported, so you'd have to modify function COM_whatsNewBlock (in lib-common.php) ...

bye, Dirk
 Quote

Status: Banned

machinari

Forum User
Full Member
Registered: 22/03/04
Posts: 1512
...or you could create a new portal block using your own site's feed. Just my two cents
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 12/01/02
Posts: 13073
Location:Stuttgart, Germany
Quote by machinari: ...or you could create a new portal block using your own site's feed.

Hey, that's a clever idea Its a deal - shaking hands

And to get rid of the New Stories section of the What's New block, you can switch it off in config.php.

bye, Dirk
 Quote

Status: offline

willyfi

Forum User
Newbie
Registered: 04/01/05
Posts: 12
Thanks a lot for your answers.

I'd tried with the portal block, but I had a problem with the character encoding. Although I set the character encoding to iso-8859-1 (in the website and in the feed), some characters were incorrect in the block. Do you know how to fix this?

Thx!
 Quote

Rosamunda

Anonymous
...or you could create a new portal block using your own site's feed.


I´m sorry, but I´ve no idea of how can I do that.
Can you help me?

Thanks in advance!

Rosamunda
 Quote

Status: Banned

machinari

Forum User
Full Member
Registered: 22/03/04
Posts: 1512
from your admin menu > blocks > new block

now in your block editor select portal block as "block type"

under "Portal Block Options" put the url of your site's feed in the "RSS URL" field. the url of your site's feed will be http://yoursite.com/backend/geeklog.rdf. click save.

if you are not sure of the link to your site's feed or even if your site has a feed, then go to admin > content syndication and note the link (if any) displayed under the heading "feed name". If there is no link, create a new feed.

hope that helps
 Quote

Tim

Anonymous
1) You can create a block that calls a custom function
2) Create the php_new_stories function and put in your lib-custom.php file.
3) This function can use the base code found in:
http://www.pigstye.net/gplugs/article.php/20041001145241777
to create a list of the 5 most recent postings.

I hope this helps...
 Quote

Status: offline

athenian47

Forum User
Junior
Registered: 24/01/05
Posts: 15
Location:Athens, Georgia, USA
Has anyone come up with a way to modify the What's New block? That block would be the most attractive place to put a new stories list.

I can't get that new stories function to work as a php block because the code gives me an SQL error for some reason.

I'm using a portal block for now.
 Quote

n00b

Anonymous
curious
Hie,

Here is the situation:
Topic: Research
Story: Security
...
... story text
...
end of story

...
... list of other stories in this topic (only story names)
...

How can I achieve this?

Thanx in advance!

PS: I already checked RSS, quite OK, but still not what I wanted...

Rgds,
KJ
 Quote

n00b

Anonymous
Hie,

PHP Formatted Code

$test = DB_query(select * from $_tables['stories'] where tid = 'corporate');
$BB = DB_fetchArray($test);

echo $BB;


 


This is something what I wanna add to "article.php", so that it will display the other stories in the same topic.

I am able to run the sql statement, getting the results expected... but so far, couldnt identify how to get it in geeklog...

If I'm doing mistakes, please correct me... and actually help! Smile

Rgds,
 Quote

n00b

Anonymous
Actually,

I want the page that you can see when you click "More on $_TOPIC_ID" link.
Which does a search, and displays the result of search with criteria "tid".

Rgds,
 Quote

Status: Banned

machinari

Forum User
Full Member
Registered: 22/03/04
Posts: 1512
you are asking for what you already have. The only difference is where the output is... Since I am procrastinating today anyway, here you go.

put this function into your lib-custom.php:
PHP Formatted Code

//returns a list of articles (minus the current article) according to topic ID
function listArticlesPerTopic($tid,$sid)
{
    global $_TABLES, $_CONF;
    $retval = '';

    //query stories by tid
    //and check for same perm as what's new block
    $A = DB_query("SELECT title, sid FROM {$_TABLES['stories']}
        WHERE tid='$tid' AND sid<>'$sid'
        AND (date <= NOW()) AND (draft_flag = 0)"
. COM_getPermSQL( 'AND' )
        . " ORDER BY date DESC");

    //build list    
    if (DB_numRows($A) >= 1){
        $retval = '<ul>';
        while ($B = DB_fetchArray($A)){
            $articleUrl = COM_buildUrl( $_CONF['site_url'] . '/article.php?story=' . $B['sid'] );
            $retval .= '<li>';
            $retval .= '<a href="' . $articleUrl . '">' . stripslashes($B['title']) . '</a>';
            $retval .= '</li>';
        }
        $retval .= '</ul>';
    }
    return $retval;
}


 


Insert the following into article.php around line 225 (I included the context):
PHP Formatted Code

            $story_template->set_var ('whats_related', $related);
            $story_template->set_var ('story_options', $optionsblock);
            $story_template->set_var ('whats_related_story_options',
                    $related . $optionsblock);
            //********************* the following added by machinari
            $article_list = listArticlesPerTopic($A['tid'],$story);
            if(!empty($article_list)){
                $topic = DB_getItem( $_TABLES['topics'], 'topic', "tid = '{$A['tid']}'" );
                $moreblock = COM_startBlock ($LANG24[38] . ' ' . stripslashes( $topic ), '',
                    Com_getBlockTemplate ('other_stories_block', 'header'))
                    . $article_list
                    . Com_endBlock (COM_getBlockTemplate ('other_stories_block', 'footer'));
                $story_template->set_var ('other_stories_this_topic', $moreblock);
            }
            //****************** the above added by machinari

            // if (DB_count($_TABLES['pollquestions'],'qid',$story) > 0) {
            //     $display .= COM_showPoll(80,$story);
            // }

            $story_template->set_var ('formatted_article',
                                      STORY_renderArticle ($A, 'n'));


 


...and insert this template variable into layout/yourtheme/topic/article.thtml: {other_stories_this_topic}.
for example (professional theme):
PHP Formatted Code

        {formatted_article}
        <table border="0" width="100%">
            <tr><td valign="top">{whats_related}</td>
                <td valign="top">{story_options}</td>
                <td valign="top">{other_stories_this_topic}</td></tr>
        </table>
        {commentbar}



 
 Quote

n00b

Anonymous
angelic
Thanx a lot machinari!

Thats what I was looking for!

Now, there is another block on right-hand side which has all titles of stories (sorted by$tid).

Here we go Smile
How do I get it not as block on right/left side, but as a text below the story?
(by the way, using "Classic" theme)

But, anyway, its working OK!
 Quote

Status: Banned

machinari

Forum User
Full Member
Registered: 22/03/04
Posts: 1512
you would just edit the template file in question (article.thtml) placing the variable to be replaced anywhere you like. for example (Classic):
PHP Formatted Code

                            {formatted_article}<br>
                            {commentbar}
                            {other_stories_this_topic}
                        </td>
                        <td>
                            <img src="{site_url}/images/speck.gif" height="1" width="10" alt="">
                        </td>
                        <td valign="top" width="180">
                            {whats_related_story_options}<br>
                            <img src="{site_url}/images/speck.gif" width="180" height="1" alt="">
   


 
 Quote

n00b

Anonymous
angelic
machinari everything is OK, cool... working...
But for some reason I cannot get it as a PHPBLOCK...

I create a new block (php block) phpblock_listArticlesPerTopic

I got this:

Error in PHP Block. Function, phpblock_listArticlesPerTopic, does not exist.

Rgds,
KJ
 Quote

Status: offline

beewee

Forum User
Full Member
Registered: 05/08/03
Posts: 969
Location:The Netherlands, where else?
Perhaps I don't understand it, but do you know that the stories_by_topic block almost does exactly what you need? It shows the titles of the newest stories, you can set the topics you want to show and/or merge the results as well....
Dutch Geeklog sites about camping/hiking: www.kampeerzaken.nl | www.campersite.nl | www.caravans.nl | www.caravans.net
 Quote

Status: Banned

machinari

Forum User
Full Member
Registered: 22/03/04
Posts: 1512
Quote by n00b:
I create a new block (php block) phpblock_listArticlesPerTopic

I got this:

Error in PHP Block. Function, phpblock_listArticlesPerTopic, does not exist.

Rgds,
KJ

you have to ensure that the function name is the same as what you put into the block editor, i.e., "listArticlesPerTopic" should be "phpblock_listArticlesPerTopic" as your error makes clear.

...and beewee makes a good point
 Quote

All times are EDT. The time is now 01:59 pm.

  • 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