Page 1 of 1

Information Pages "code" type

Posted: Wed Dec 01, 2010 1:29 am
by Qphoria
This was something I saw in Website Baker and wanted to add to opencart. When creating pages in WSB you can choose the "type" of page it is (wysiwyg, code, faq, etc). They actually have this extensible so that you can create new types as modules and choose from custom module templates. So wysiwyg loads the wysiwyg editor, form loads the form designer, faq loads a Q&A designer, etc.

While that would be ideal to have a system like that in OC, for now I wanted to add a simple modification to allow "code" type to be used for information pages. This means that you can actually have different content show based on what conditions you setup. Dynamic Information pages!

So I did it.

Check my DEMO.
It simply shows whether you are logged in or not.
You can login with demo@demo.com/demo and see the message change again when you log back out.
This is just a simple example but much more can be achieved and the code change is quite simple.

This is how it looks in the admin:
http://www.screencast.com/users/DssTrai ... 5f621ae683

I'm going to play with it more and perhaps release it as a mod but I'd like to put it into the core as well at some point. Perhaps with an updated php syntax editor like this:
http://codepress.sourceforge.net/index.php
or
http://www.lostintechnology.com/interne ... -on-the-go

Re: Information Pages "code" type

Posted: Wed Dec 01, 2010 5:27 am
by Johnathan
Nice work! It's an interesting idea, and something that would be neat to have in the core at some point in the future.

Re: Information Pages "code" type

Posted: Wed Dec 01, 2010 5:35 am
by i2Paq
Yes, that is what I like about WB to!

Plus you can mix pages of a different kind and even change the order in which they appear.

Re: Information Pages "code" type

Posted: Wed Dec 01, 2010 7:35 am
by Xsecrets
looks interesting unfortunately that first linked highlighter does not work in chrome.

I like the idea of being able to put code into the pages from a usability perspective, but the little security minded voice in the back of my head kind of screams eval() NOOOOO! :crazy:

Re: Information Pages "code" type

Posted: Wed Dec 01, 2010 10:27 am
by Qphoria
Xsecrets wrote:but the little security minded voice in the back of my head kind of screams eval() NOOOOO! :crazy:
They have meds for that :)

Re: Information Pages "code" type

Posted: Wed Dec 01, 2010 11:42 am
by HTMLCSSNoob
Qphoria wrote:form loads the form designer, faq loads a Q&A designer, etc.
I'm all for the form and FAQ designer. It would be great if we could use the form designer on the contact us page so we could create our own custom contact us form easily.

The FAQ form designer would be great too of course.

Look forward to it!

Re: Information Pages "code" type

Posted: Fri May 24, 2019 2:42 am
by HomeroOttoni
Qphoria wrote:
Wed Dec 01, 2010 1:29 am
This was something I saw in Website Baker and wanted to add to opencart. When creating pages in WSB you can choose the "type" of page it is (wysiwyg, code, faq, etc). They actually have this extensible so that you can create new types as modules and choose from custom module templates. So wysiwyg loads the wysiwyg editor, form loads the form designer, faq loads a Q&A designer, etc.

While that would be ideal to have a system like that in OC, for now I wanted to add a simple modification to allow "code" type to be used for information pages. This means that you can actually have different content show based on what conditions you setup. Dynamic Information pages!

So I did it.

...
Hi.

I would like to insert php code into my info pages, in Opencart 3.01, is it possible?
Can you help me with this question?

Thank you.

Re: Information Pages "code" type

Posted: Fri May 24, 2019 11:08 am
by IP_CAM
You could try this free Mod:
OpenCart Template Switcher
https://www.opencart.com/index.php?rout ... n_id=31589
---
or then, you could try this:
https://php2twig.com/
---
Ernie
Image

Re: Information Pages "code" type

Posted: Sat May 25, 2019 2:10 am
by HomeroOttoni
Sorry, I did not understand your suggestion (but thank you anyway).
The information pages of Opencart 3.0 are not files, but their code is registered in a table called "information_descriptions".

When I enter a code directly into the registry, for example:

<? php echo "Hello wolrd!"?>

The system replaces:

<! - <? php echo "Hello wolrd!"?> ->

And the page does not "spin" the code. I need a way to insert code into these pages in order to avoid this. Be PhP, be javascript.

According to Qphoria he managed and placed a new item in the information pages that allows you to choose the format.

http://www.screencast.com/users/DssTrai ... 5f621ae683

Thank you