Welcome to Geeklog, Anonymous Friday, March 29 2024 @ 10:29 am EDT

Geeklog Forums

separating intro text from body text


Status: offline

clunk

Forum User
Newbie
Registered: 06/09/05
Posts: 9
Location:London
How about being able to separate the intro text from the body text when 'read more' is clicked. Does anyone know how to do this? Or could someone point me in the direction of where exactly the two are merged together to form {story_introtext}.
Clunk! Thud! Clank!
 Quote

Status: Banned

machinari

Forum User
Full Member
Registered: 03/22/04
Posts: 1512
if you are talking about separating the intro from the body with a br tag, then use {story_introtext}, and without breaks, {story_text_no_br}.

if you want to separate the variables into intro and body, find this in lib-story.php in the function STORY_renderArticle() at about line 188ff:
Text Formatted Code
    if( $index == 'n' )
    {
        $article->set_var( 'story_title', stripslashes( $A['title'] ));
        if( empty( $A['bodytext'] ))
        {
            $article->set_var( 'story_introtext', $introtext );
            $article->set_var( 'story_text_no_br', $introtext );
        }
        else
        {
            $bodytext = stripslashes( $A['bodytext'] );
            $bodytext = PLG_replacetags($bodytext);   // Replace any plugin autolink tags
            $article->set_var( 'story_introtext', $introtext . '<br><br>'
                               . $bodytext );
            $article->set_var( 'story_text_no_br', $introtext . $bodytext );
        }
    }

 
and change it to look like this:
Text Formatted Code
    if( $index == 'n' )
    {
        $article->set_var( 'story_title', stripslashes( $A['title'] ));
        if( empty( $A['bodytext'] ))
        {
            $article->set_var( 'story_introtext', $introtext );
            $article->set_var( 'story_text_no_br', $introtext );
            $article->set_var( 'only_introtext', $introtext );
        }
        else
        {
            $bodytext = stripslashes( $A['bodytext'] );
            $bodytext = PLG_replacetags($bodytext);   // Replace any plugin autolink tags
            $article->set_var( 'story_introtext', $introtext . '<br><br>'
                               . $bodytext );
            $article->set_var( 'story_text_no_br', $introtext . $bodytext );
            $article->set_var( 'only_introtext', $introtext );
            $article->set_var( 'only_bodytext', $bodytext );
        }
    }

 
now you may use the variables, {only_introtext} and {only_bodytext} in place of {story_introtext} or {story_text_no_br}. You should now that much more control over how the article appears.

hope that helps.
 Quote

Status: offline

drshakagee

Forum User
Full Member
Registered: 10/01/03
Posts: 231
That is a nice bit of code that really helps out on this site I am working on. The "what's related" and "story options" blocks can now go in between the introtext and bodytext which really helps to clean up the look (for the theme I am using at least).

Thanks! Perhaps you should submit this as a patch or something so it can be in the core for future versions. I don't think it takes much overhead or anything.
Yes I am mental.
 Quote

Status: offline

clunk

Forum User
Newbie
Registered: 06/09/05
Posts: 9
Location:London
Hmmm, wait a minute. Do I use the {only_bodytext} instead of {story_introtext} in the storytext.thtml file? When I do this, no text turns is on the home page but it's all perfect when I click on the 'read more' link.

What I need is just the intro text on the home page and then just bodytext on the click-through page. Is this possible?
Clunk! Thud! Clank!
 Quote

All times are EDT. The time is now 10:29 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