QUESTION A page as a host for information about other pages - Printable Version +- GetSimple Support Forum (http://get-simple.info/forums) +-- Forum: GetSimple (http://get-simple.info/forums/forumdisplay.php?fid=3) +--- Forum: General Questions and Problems (http://get-simple.info/forums/forumdisplay.php?fid=16) +--- Thread: QUESTION A page as a host for information about other pages (/showthread.php?tid=9920) |
A page as a host for information about other pages - lotova - 2017-08-06 I want to select some created pages according to their creation date and values of some other fields and insert their title and creation date (and maybe some other meta information) with links to every respective page in another page. I want that content of the destination page is provided automatically, that is if a page is created that meets criteria its title etc. appears in the destination page and when the criteria cease to be valid (a time elapses) it disappears from it (shortly, I want imitate official notice board). I know that information about all pages is stored in $pagesArray array so I can obtain information from there and write some function that selects desired pages. But there are two things that I don't know: where should I place such function and how I insert the result of that function in the destination page? RE: A page as a host for information about other pages - Bigin - 2017-08-07
PHP Code: if(get_page_slug(false) == 'your-page-slug') { RE: A page as a host for information about other pages - lotova - 2017-08-08 Thank you. RE: A page as a host for information about other pages - lotova - 2017-08-10 (2017-08-07, 00:42:40)Bigin Wrote: I have a problem with your advice. Before I asked my question I put my function for testing purpose into the sidebar.inc.php and it works well (the function displays what I want in the sidebar). But if I put the function in the template file almost nothing displays in a page and there is only a notice and a warning in the debug mode: Notice: Undefined variable: pagesArray in /var/www/html/ret/theme/Innovation/functions.php on line 53, Warning: Invalid argument supplied for foreach() in /var/www/html/ret/theme/Innovation/functions.php on line 53. (I have foreach ($pagesArray as $key => $value) { on line 53). So, the function knows the variable $pagesArray if located in sidebar.inc.php but doesn't know it if located in template.php. How can I fix it? RE: A page as a host for information about other pages - Bigin - 2017-08-10 Probable your foreach() construct is wrapped in a function call: PHP Code: your_function() { You'll need to make the $pagesArray available locally: PHP Code: your_function() { But this is really basic knowledge RE: A page as a host for information about other pages - lotova - 2017-08-10 Yes, I realized almost immediately that I put only a sequence of commands in the sidebar.inc.php, not a function. So, I am sorry for a hasty question. RE: A page as a host for information about other pages - Bigin - 2017-08-10 no problem |