1 (edited by 2008-08-24 15:40:37)

Topic: [HACK] Split up Articles

$matches[1] Span An Article over pages
$matches[1] John/Will
$matches[1] 1.3.6 - * (no incompatibility reported yet)
$matches[1] have pagination for long articles. so 1 article can be split into a next.
Useful in lengthy articles or tutorials to control amount of information displayed at a time.
$matches[1]
$matches[1]
MAKE A BACKUP COPY OF SHOWS.INC.PHP in your INC folder before you begin doing this hack! .. just in case you make a mistake somewhere along the lines.

First off, access $matches[1] and comment out or completely remove line 227, which by my calculations is:

$output = str_replace("{full-story}", $news_arr[4], $output);

Then replace it with:

$page_array = explode("[pagebreak]", $news_arr[4]);
$pagination = "";
if($page_num == ''){ $page_num = 1; }
if ( count($page_array) > 1){
if($page_num != 1){ $less=$page_num-1; $pagination .= "[url=subaction=showcomments&id=$news_arr[0]&archive=$archive&start_from=$my_start_from&ucat=$news_arr[6]&$user_query&page_num=$less>«</a> ]$for_to = count($page_array);
for ($i=1; $i<=$for_to; $i++){
if ($i == $page_num){ $pagination .= $i; }
else{ $pagination .= " [url=subaction=showcomments&id=$news_arr[0]&archive=$archive&start_from=$my_start_from&ucat=$news_arr[6]&$user_query&page_num=$i]»[/url] ]$output = str_replace("{full-story}", $page_array[$page_num-1]."
".$pagination."
", $output);
}
else{ $output = str_replace("{full-story}", $page_array[0], $output); }

So now if you want to add another page, simply add $matches[1] and the code will do the rest.

$matches[1]
Remove all aspects of "showcomments" and replace with "showfull" if you dont want comments to appear with every split section of an article you write.

$matches[1]
If you find >> or << these are your "Next" and "Previous" links....You can change them accordingly!

$matches[1]
$pagination = ""; and replace with
$pagination = "<div align=center>Go to Page
";
this makes a text appear at the bottom of each split article with "Go to Page" a line break and then the numbers below! it also centers the "Go to Page" !

Remember to add </div> on this line:

<a href=?subaction=showcomments&id=$news_arr[0]&archive=$archive&start_from=$my_start_from&ucat=$news_arr[6]&$user_query&page_num=$more>»HERE</div>HERE[/url]


by Adding pagination to news articles (multiple pages) something this must be done first:

Open $matches[1] and at line 5 and 6 you'll see parts of code like this:

array("start_from", "archive", "subaction", "id", "ucat")

and at the both you must add "page_num", like this:

array("page_num", "start_from", "archive", "subaction", "id", "ucat")

so the line 5 and 6 should look finally like this:

$user_query = cute_query_string($QUERY_STRING, array("page_num",  "start_from", "archive", "subaction", "id", "ucat"));
$user_post_query = cute_query_string($QUERY_STRING, array("page_num","start_from", "archive", "subaction", "id", "ucat"), "post");

You should be good from here on in... Please read and understand this before attempting this hack... Having to explain it in full takes a good bit of typing.