Hello!
I'm totally new to this scene, and jus started making plugins last night.
I know that $article->text contains the whole article text. However, what variable contains parts of the text when i use pagebreak?
The thing is, if I try to wrap $article->text with divs, then the </div> will be removed by the pagebreak and not used until the last article segment. That breaks the template. (I'm using ja purity).
Therefore, I want to wrap each article segment in divs.
Please help,
Thanks,
Nadeem
What variable has the segments of an article with pagebreak?
Moderators: tjay, seadap, Rogue4ngel, matthewhayashida
Forum rules
Re: What variable has the segments of an article with pagebreak?
Peace Guys!
Ok. So I managed to find a way around the problem. I used the hr pagebreak line that is in $article->text. What I needed on the end of the previous page, I added before the hr code. What I needed on the beginning of the current page, I added after the hr code. I needed this so that the footnotes plugin didn't break my template. This is hack I put in after line 57 of footnotes.php:
As you can see, this is the line where the magic happens:
If you want to do what I did, just replace <footnotes_end> with whatever you want to appear on the end of each page, except the last, and <footnotes_start> with whatever you want to appear at the beginning of each page, except the first. These limitations are explained by the position of the pagebreak-hr.
Thanks,
Nadeem Qureshi
Ok. So I managed to find a way around the problem. I used the hr pagebreak line that is in $article->text. What I needed on the end of the previous page, I added before the hr code. What I needed on the beginning of the current page, I added after the hr code. I needed this so that the footnotes plugin didn't break my template. This is hack I put in after line 57 of footnotes.php:
Code: Select all
//This shit must only go down as longs as showall is crippled
if ($_GET["showall"] != 1)
{
//Hr trick
$article->text = preg_replace("/<hr(.*)class=\"system-pagebreak\"(.*)\/>/iU", "<footnotes_end> <hr $1 class=\"system-pagebreak\" $2 /> <footnotes_start>", $article->text );
//Let us begin at the beginning.... by the opening encapsulating tag
$beginning = '<div id="data_' . $article->id . '">';
//Now, lets swap <footnotes_start> with $beginning
$article->text = str_replace('<footnotes_start>', $beginning, $article->text);
//Then lets finish with the end, by adding footnote holder
$end = '<div id="footnotes_' . $article->id . '" class="footnoteholder"><h3>Fotnoter</h3></div>' . "\n";
//Some javascript
$end .= '<script type="text/javascript">' . "\n";
$end .= "formatFootnotes('data_" . $article->id . "','footnotes_" . $article->id . "'); \n";
$end .= '</script></div>';
//let swap <footnotes_end> with $end
$article->text = str_replace('<footnotes_end>', $end, $article->text);
}
Code: Select all
$article->text = preg_replace("/<hr(.*)class=\"system-pagebreak\"(.*)\/>/iU", "<footnotes_end> <hr $1 class=\"system-pagebreak\" $2 /> <footnotes_start>", $article->text );
Thanks,
Nadeem Qureshi