Member
Member
gjr   2009-11-10, 04:22
#1
Hi,

I am using the zenpage function printLatestNews() on the index.php page. When I goto page 2 because the album list is paginated I get this error for the latest news:

Warning: Invalid argument supplied for foreach() in F:\.......\zp-core\plugins\zenpage\zenpage-template-functions.php on line 1171

I am not sure exactly how pagination works, but it seems this function is trying to list the next x news, but the array is empty on subsequent pages. Is this a bug?

I am using 1.2.6 on a local setup so sorry i cannot provide a link....

Note: I am using the "none" option - just list news (no images)...
Administrator
Administrator
acrylian   2009-11-10, 10:13
#2
That function is actually independed and should no be affected by the pagination. Please post how you call the function and where on index.php.
Member
Member
gjr   2009-11-10, 11:47
#3
printLatestNews(4,'none','',true,true,150,true);

I call this on a custom theme, in a "sidebar" on index.php. In the main window is the album loop causing the pagination.
Administrator
Administrator
acrylian   2009-11-10, 12:02
#4
I just tried with then zenpage-default theme's sidebar and besides missing correct css setup I could not see any issues. Please try that theme, too. Since you use a custom theme something must be different.
Member
Member
gjr   2009-11-11, 00:25
#5
Hmm. I did the same Acrylian with the same error...

I put:
<?php printLatestNews( 4,'none','',true,true,150,true ); ?>
in sidebar.php in the zenpage-default theme.

On the homepage it appears fine. When I click page 2 on the home page I get the error where the latest news should appear:

Warning: Invalid argument supplied for foreach() in F:\......\zp-core\plugins\zenpage\zenpage-template-functions.php on line 1171
Administrator
Administrator
acrylian   2009-11-11, 10:27
#6
Sorry, as said I was not able to reproduce it with the current nightly build and the zenpage-default theme.
Member
Member
gjr   2009-11-11, 23:43
#7
Quote:That function is actually independed and should no be affected by the pagination
The function calls this function in zenpage core functions:
function getNewsArticles($articles_per_page='', $category='', $published=NULL)

It makes me think pagination is affecting it, at least for me. I will see if I can get a test site up for you to view...
Administrator
Administrator
acrylian   2009-11-12, 10:11
#8
That function is used to get paginated articles but it should not be affected as the number is passed directly to the function and not set automatically.

A demo site would be good as everything else would be guessing.
Member
Member
gjr   2009-11-12, 18:02
#9
Please view the error here, second index page using pagination:

http://www.blueskywebcreations.com/zenphoto/

Default install, activated zenpage, uploaded albums via ftp, created 3 news articles, activated zenpage-default theme, added the following to sidebar.php in zenpage-dafault:

`

<?php if(function_exists("printLatestNews")) { ?>



<?php echo gettext("Latest News"); ?>

<?php printLatestNews( 4,'none','',true,true,150,true ); ?>



<?php } ?>

`
Administrator
Administrator
acrylian   2009-11-12, 18:08
#10
Ok, thanks. I see it and will take a look.
Administrator
Administrator
acrylian   2009-11-12, 18:37
#11
Quick update, I was now able to reproduce and it will be fixed in tonight's nightly.
Member
Member
gjr   2009-11-13, 14:31
#12
Solved in nightly, Thanks Acrylian!
  
Powered By MyBB, © 2002-2026 MyBB Group.
Made with by Curves UI.