1 (edited by 2012-11-04 21:56:31)

Topic: Multiple include: pagination

Using multiple include in CN 1.5, I would like to insert pagination, but it has to work only for the main include, not for the second include too. This last must be indipendent of the main include. Instead, in my news page http://www.pasqualemarinelli.com/indexb.php, you can see it isn't so! Can you help me, please?

Re: Multiple include: pagination

Your include codes are probably something like

<?php
$number = 5;
include('/cutenews/show_news.php');
?>
...
<?php
$template = 'side';
$number = 2;
include('/cutenews/show_news.php');
?>

Provided that the middle include comes before the one on the right-hand side in your file, do the following after the first include() line:

unset($_GET['start_from']);

So:

<?php
$number = 5;
include('/cutenews/show_news.php');
unset($_GET['start_from']);
?>


in the example above.

It's not particularly elegant, but it's fast and it works.

3 (edited by 2012-11-05 23:47:45)

Re: Multiple include: pagination

the middle include comes AFTER the one on the right-hand side, so this doesn't work. Any suggestions?

this is the right-hand include side:

 <?php
$number=2;
$template="Microblog";
$category=9;
$static=TRUE;
include("/home/pasqu0/public_html/b/show_news.php");
?>

this is the middle include:

<?php
$template="Default";
$number = "5";
                                    /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                    Here we decide what page to include
                                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
                                    if($_POST['do'] == "search" or $_GET['dosearch'] == "yes"){ $subaction = "search"; $dosearch = "yes"; include("./b/search.php"); }
                                    elseif($_GET['do'] == "archives"){ include("./b/show_archives.php"); }
                                    elseif($_GET['do'] == "search"){ include("./b/search.php"); }
                                    elseif($_GET['do'] == "stats"){ echo"You can download the stats addon and include it here to show how many news, comments ... you have"; /* include("$path/stats.php"); */ }
                                    else{ include("./b/show_news.php"); }
                                    
                                    ?>

4 (edited by 2012-11-06 13:01:47)

Re: Multiple include: pagination

Thanks for the information!  I don't know why the $static variable was removed in CuteNews 1.5 — it was a very useful include parameter.

We'll just make even uglier code, then! Assuming that your code is:

<?php
$template = 'side';
$number = 2;
include('/cutenews/show_news.php');
?>
...
<?php
$number = 5;
include('/cutenews/show_news.php');
?>

change to

<?php
$my_get = $_GET;
$_GET = array();

$template = 'side';
$number = 2;
include('/cutenews/show_news.php');
?>
...
<?php
$_GET = $my_get;
$number = 5;
include('/cutenews/show_news.php');
?>

I call this "even uglier" code because it really is, but it's fast and it does the trick. Nothing to worry. https://cutephp.com/forum/style_emoticons/default/smile.gif

5 (edited by 2012-11-06 13:41:31)

Re: Multiple include: pagination

I tried but pagination and full story don't work anymore (you can see here: http://www.pasqualemarinelli.com/indexb.php)

This is the side include:

<?php
$my_get = $_GET;
$_GET = array();
$number=2;
$template="Microblog";
$category=9;
$static=TRUE;
include("/home/pasqu0/public_html/b/show_news.php");
?>

This is the middle include:

<?php
$_GET = $my_get;
$template="Default";
$number = "5";
                                    /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                    Here we decide what page to include
                                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
                                    if($_POST['do'] == "search" or $_GET['dosearch'] == "yes"){ $subaction = "search"; $dosearch = "yes"; include("./b/search.php"); }
                                    elseif($_GET['do'] == "archives"){ include("./b/show_archives.php"); }
                                    elseif($_GET['do'] == "search"){ include("./b/search.php"); }
                                    elseif($_GET['do'] == "stats"){ echo"You can download the stats addon and include it here to show how many news, comments ... you have"; /* include("$path/stats.php"); */ }
                                    else{ include("./b/show_news.php"); }
                                    
                                    ?>


Please help me!!!!

Re: Multiple include: pagination

Alright, this time I think we have our solution:

<?php
$start_from = 0;
$subaction = '';

// Side include
$number = 2;
$template = 'Headlines';
include('show_news.php');
?>

<?php
$start_from = isset($_GET['start_from']) ? $_GET['start_from'] : 0;
$subaction = isset($_GET['subaction']) ? $_GET['subaction'] : '';

// Main include
$number = 4;
include('show_news.php');
?>

Re: Multiple include: pagination

Well done lKj... it works!!! Thank you very very much

Re: Multiple include: pagination

No problem — I'm glad your issue could be solved. https://cutephp.com/forum/style_emoticons/default/smile.gif Take care.

Re: Multiple include: pagination

No problem — I'm glad your issue could be solved. https://cutephp.com/forum/style_emoticons/default/smile.gif Take care.

I had the same problem and your solution works very well!
Thanks for your time to help us out!

Posts: 9

Pages 1

You must login or register to post a reply

CutePHP Forums → Problem Solving / Help & Support → Multiple include: pagination



The pun_antispam official extension is installed. Copyright © 2003–2009 PunBB.