Welcome to Geeklog, Anonymous Thursday, November 28 2024 @ 12:57 pm EST
Geeklog Forums
Need a Hack for Body Text
Status: offline
orfilms
Forum User
Regular Poster
Registered: 08/02/05
Posts: 70
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?
Can anyone help me out on this one?
7
12
Quote
Status: Banned
machinari
Forum User
Full Member
Registered: 03/22/04
Posts: 1512
in lib-story.php (in your system dir) starting at about line 188, find the following:
{
$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):
{
$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.
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 now add your content where you see the $putYourContentHere variable as you see it in the following (notice that the variable appears twice):
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>' . $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.
9
9
Quote
Status: offline
orfilms
Forum User
Regular Poster
Registered: 08/02/05
Posts: 70
I don't know much about php so please excuse me
I added the code I wanted in the possition of the varriable, which works. I don't know how I'd even begin to do the things you listed below the code.
However the code does what I want it to do BUT the code I'm adding appears when there is no body text. I want to somehow make it so that the code will not be added if there is no bodytext. How would I do this?
Thanks
I added the code I wanted in the possition of the varriable, which works. I don't know how I'd even begin to do the things you listed below the code.
However the code does what I want it to do BUT the code I'm adding appears when there is no body text. I want to somehow make it so that the code will not be added if there is no bodytext. How would I do this?
Thanks
13
7
Quote
Status: Banned
machinari
Forum User
Full Member
Registered: 03/22/04
Posts: 1512
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.
Ensure that your special content is in the "else" part of the above code.
10
6
Quote
All times are EST. The time is now 12:57 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