Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Use PHP in a component
#1
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.
Reply
#2
PMB Wrote: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.

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'); ?>
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
#3
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

Header values specify a configuration that is not implemented.

ModSecurity, web application firewall, possible secure attack prevention.

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.
Reply
#4
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?
|--

Das deutschsprachige GetSimple-(Unter-)Forum:   http://get-simple.info/forums/forumdisplay.php?fid=18
Reply
#5
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.
Reply
#6
PMB Wrote:I'm just try to test what I can and can't do.

that's a good approach ;=)
|--

Das deutschsprachige GetSimple-(Unter-)Forum:   http://get-simple.info/forums/forumdisplay.php?fid=18
Reply
#7
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?
Reply
#8
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'; ?>
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
#9
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 content
require_once("filename.php");
template content:
<?php get_component('componentname'); ?>
it stops page rendering.

However this way:
Quote:template content:
<?php require_once("filename.php"); ?>
it works fine, even with further call of filename functions in the template.
Reply




Users browsing this thread: 2 Guest(s)