**Disclaimer** I'm not a programmer and know enough to break things but, can follow directions***
Greeting all,
I've been searching and lurking around trying to find an answer to this and I see that it's been asked before.
I would like to add new content to my site that will display in the main content area like a information page or pretty much anything else.
The catch here is, I want to include some dynamic content at times. For this go-around I would like to include another script. This script (a plugboard) already has instructions for inclusion using <? include "path to script"; ?>.
I can not figure out a way to achieve this. I came across this : http://forum.opencart.com/viewtopic.php?f=112&t=18222 but, of course would rather not compromise security.
Any help or suggestions?
Thank you
Greeting all,
I've been searching and lurking around trying to find an answer to this and I see that it's been asked before.
I would like to add new content to my site that will display in the main content area like a information page or pretty much anything else.
The catch here is, I want to include some dynamic content at times. For this go-around I would like to include another script. This script (a plugboard) already has instructions for inclusion using <? include "path to script"; ?>.
I can not figure out a way to achieve this. I came across this : http://forum.opencart.com/viewtopic.php?f=112&t=18222 but, of course would rather not compromise security.
Any help or suggestions?
Thank you
You won't be able to include other scripts without some sort of security implications.
I certainly would not recommend the solution from the other thread. If you really want to run php code in information pages you could change the following code in catalog/view/theme/default/template/information/information.tpl
to
then you can put php code into the information page the same way you put html code in.
There are security implications with this as well, but not nearly as severe as the solution from the other thread you linked.
you should research possible security issues with the use of eval() though.
I certainly would not recommend the solution from the other thread. If you really want to run php code in information pages you could change the following code in catalog/view/theme/default/template/information/information.tpl
Code: Select all
<?php echo $description; ?>
to
Code: Select all
<?php eval($description); ?>
There are security implications with this as well, but not nearly as severe as the solution from the other thread you linked.
you should research possible security issues with the use of eval() though.
OpenCart commercial mods and development http://spotonsolutions.net
Layered Navigation
Shipment Tracking
Vehicle Year/Make/Model Filter
Thank you for the replies.
Xsecrets> It doesn't have to be a "Information" page per-say, but if that is an option I'll look into along with the suggestion of the research.
When I made that change, then went into the Admin area, select a info page or create a new one, the built-in editor removes the <? include "path to script"; ?>.
and the result was this:
Line 10 is were the change was made.
Qphoria> Wouldn't that put it on every product page? That's not what I want.
I would like to have a completely separate page for reciprocal link/banner exchanging.
This is what I got when I tried to include it into the product.tpl
So of course I'm missing something. I wish there was a mod for this sort of stuff.
Xsecrets> It doesn't have to be a "Information" page per-say, but if that is an option I'll look into along with the suggestion of the research.
When I made that change, then went into the Admin area, select a info page or create a new one, the built-in editor removes the <? include "path to script"; ?>.
and the result was this:
Code: Select all
Parse error: syntax error, unexpected T_VARIABLE, expecting '(' in /home/rattus/public_html/store/catalog/view/theme/default/template/information/information.tpl on line 10
Qphoria> Wouldn't that put it on every product page? That's not what I want.
I would like to have a completely separate page for reciprocal link/banner exchanging.
This is what I got when I tried to include it into the product.tpl
Code: Select all
Warning: include(http://rattydaddys.com/pub/plug.php) [function.include]: failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in /home/rattus/public_html/store/catalog/view/theme/default/template/product/product.tpl on line 259Warning: include(http://rattydaddys.com/pub/plug.php) [function.include]: failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in /home/rattus/public_html/store/catalog/view/theme/default/template/product/product.tpl on line 259Warning: include() [function.include]: Failed opening 'http://rattydaddys.com/pub/plug.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/rattus/public_html/store/catalog/view/theme/default/template/product/product.tpl on line 259
So of course I'm missing something. I wish there was a mod for this sort of stuff.
I was afraid of that. I didn't check to see if the editor striped things like that or not. I knew the db input did not.Rattus wrote: When I made that change, then went into the Admin area, select a info page or create a new one, the built-in editor removes the <? include "path to script"; ?>.
OpenCart commercial mods and development http://spotonsolutions.net
Layered Navigation
Shipment Tracking
Vehicle Year/Make/Model Filter
That works alright but, I want it on its own page.
Customer clicks on a links link and it's loaded in the main content area.
Then back to Xsecrets suggestion:
What I don't understand is why isn't additional PHP info parsed. Is this a function of OC or the editor excluding such info or it's possible because the Table: information_description in the dB is set to text?
I even went into PHPMyAdmin and located the specific info page and put in the include. Nada...
bah..just talking out me butt.
Customer clicks on a links link and it's loaded in the main content area.
Qphoria wrote:So then add a conditional around it
<?php
if ($this->request->get['product_id'] = '1') {
include ('filename');
}
?>
Then back to Xsecrets suggestion:
What I don't understand is why isn't additional PHP info parsed. Is this a function of OC or the editor excluding such info or it's possible because the Table: information_description in the dB is set to text?
I even went into PHPMyAdmin and located the specific info page and put in the include. Nada...
bah..just talking out me butt.
It didn't run php code that you put into the database after changing the view to use eval? I mean it does run html_entity_decode on it before passing it to the veiw, but I don't think that should affect things.Rattus wrote: Then back to Xsecrets suggestion:
What I don't understand is why isn't additional PHP info parsed. Is this a function of OC or the editor excluding such info or it's possible because the Table: information_description in the dB is set to text?
I even went into PHPMyAdmin and located the specific info page and put in the include. Nada...
bah..just talking out me butt.
OpenCart commercial mods and development http://spotonsolutions.net
Layered Navigation
Shipment Tracking
Vehicle Year/Make/Model Filter
Xsecrets wrote: It didn't run php code that you put into the database after changing the view to use eval? I mean it does run html_entity_decode on it before passing it to the veiw, but I don't think that should affect things.
Nope!
With <?php echo $description; ?> and adding the <? include "path to file"; ?> directly to the description field of Table: information_description through PHPMyAdmin, it is completly ignored and the page is blank. The line is in the page source though.
Changing the line to <?php eval ($description); ?> gives this result on ANY info page that's there.
Code: Select all
Parse error: syntax error, unexpected '<' in /home/rattus/public_html/store/catalog/view/theme/default/template/information/information.tpl(10) : eval()'d code on line 1
Who is online
Users browsing this forum: Majestic-12 [Bot] and 21 guests