I need a hack that will allow me to add some html before the body text. This is not something I want to appear on the front page (index.php) and there is no way to add this into the article.thtml file I don't think. I want it only to appear in the article pages themselves, and after the intro text, before the body text (and only if there is a body text).
Can anyone help me out on this one?
in lib-story.php (in your system dir) starting at about line 188, find the following:
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 now add your content where you see the
$putYourContentHere variable as you see it in the following (notice that the variable appears twice):
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>' . $putYourContentHere . '<br>'
. $bodytext );
$article->set_var( 'story_text_no_br', $introtext . $putYourContentHere . $bodytext );
}
}
This is just showing you where you need to get you content in order for it to appear between your intro and body text. How you actually get your content there can be done in a number of ways:
-you could just add content to the variable, which would be defined earlier and then just included as above.
-If it was me, I would separate the $introtext and the $bodytext into separate template variables. At the same time I would add another that represents my special content. Add all three variables to the proper template file, e.g., storytext.thtml, and your off and running. The special content and bodytext template variables will only be replaced by actual content on the article page (the one that displays the whole article) because of where the variables are set in lib-story.php.
hope that is what you were looking for.
The way i've positioned the variable ensures that it will only appear when bodytext is not empty--I just tested it and it works as you want it to.
Ensure that your special content is in the "else" part of the above code.