Use PHP in a component - 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: Use PHP in a component (/showthread.php?tid=2103) |
Use PHP in a component - PMB - 2011-08-26 Still playing around with GetSimple and loving it. I would like to knew if there is a way to make this work. call get_navigation(return_page_slug()) from a component ? When I attempt this it returns a error ? example : make a component named footer paste this in Code: <?php get_navigation(return_page_slug());?> Thanks for any help. Use PHP in a component - mvlcek - 2011-08-26 PMB Wrote:Still playing around with GetSimple and loving it. I would like to knew if there is a way to make this work. Which error? This should work (although you should put <ul>...</ul> around it to get valid HTML). Include the component in the template using Code: <?php get_component('footer'); ?> Use PHP in a component - PMB - 2011-08-26 I was playing around some more. It is a sever security error. It will work on my localhost. But when I went live is when everything went bad. Quote:Error 501: The server cannot complete the request because it encounters an error I have a work around working. But because i'm new to GetSimple, I'm just trying to learn best practices and what I can and can't do. Thanks for the quick reply. Use PHP in a component - Connie - 2011-08-26 please give us the info from the server health check .. you can find that in the settings / first steps this menu navigation should never be a security risk ... I see the same danger as eating ice cream ... it is harmless ;=) are you on a windows-server? another question: a navigation belongs into the template, why you put it into a component? Use PHP in a component - PMB - 2011-08-26 Hello again Connie. health check is 100%. The above was just an example. Anywhere I try to include php (without hard coding it ). I get the above error. I'm on a linux server. One nice reason I found to put the navigation in a component would be for a 3 col. footer. But yes I do understand your point about the template. I'm just try to test what I can and can't do. Use PHP in a component - Connie - 2011-08-26 PMB Wrote:I'm just try to test what I can and can't do. that's a good approach ;=) Use PHP in a component - Ampersand - 2011-11-13 if you try to put PHP into a component, can you put any quoted strings there? For simplest example echo("text");? Since get_component() relies on both eval() and stripslashes() it will output unquoted string. Double backslashes to overcome it? Use PHP in a component - mvlcek - 2011-11-13 Ampersand Wrote:if you try to put PHP into a component, can you put any quoted strings there? For simplest example echo("text");? Since get_component() relies on both eval() and stripslashes() it will output unquoted string. Double backslashes to overcome it? ??? get_component works perfectly with single and double quoted strings, e.g. a component with Code: <?php echo "double".' single'; ?> Use PHP in a component - Ampersand - 2011-11-13 yes echo works, so it must have to do with something different than escaping quotes. When I put a filename into a component, Quote:component contentit stops page rendering. However this way: Quote:template content:it works fine, even with further call of filename functions in the template. |