Black Belt
- Join Date:
- Jul 2005
- Location:
- Upstate NY
- Posts:
- 21,874
- Plugin Contributions:
- 8
Sorting EZ-Pages Into Sideboxes
Okay, zen_href_link(FILENAME_EZPAGES, is required because this doesn't refer to the sidebox at all, but to the ez-page main_page name in the URL.
define('BOX_HEADING_EZPAGES2','Box 2 Heading'); was something I expected to be already defined correctly, but didn't know you hadn't done.
I wouldn't think the $page_query would be a problem any more than the $page_query_list_sidebox, as they are both assigned from scratch in each sidebox and should wipe out any previous content, but maybe something from the first box execution carries over in spite of that. I'll have to test that.
There is one possible failure mode for the display test as is: if there are no actual ez-pages set to display in one of the sideboxes, it will still execute and show an empty box. That can be avoided by moving the filter to an earlier point, in the SQL query. This fetches all sidebox links regardless of which box they are intended to display in:```php
$page_query = $db->Execute("select * from " . TABLE_EZPAGES . " where status_sidebox = 1 and sidebox_sort_order > 0 order by sidebox_sort_order, pages_title");
if ($page_query->RecordCount()>0) {
I had been thinking that this would make a good tutorial to highlight various gotchas that might need to be dealt with when cloning a sidebox; with the additional ones you have uncovered, it would definitely save a lot of grief to also have it in packaged mod form. I'll work on that, with the SQL adaptation I mentioned.