• Welcome to WooUSEFUL by PHPVIBE . Please log in.

Allowing PHP beside HMTL in New Pages Created

Started by Icey,

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

IceyTopic starter

Hey!

So, I see that for the newly created pages, you can only write there in html and that's it. I tried to look a bit for the way to change it to also allow PHP ( which will help me a lot ) but couldn't really find a way.

Also, I am looking for a way to .. "hardcode" a new page into the source code. For exemple there is site.com/blog , which is "hardcoded" into the script, but I also want to create a new one like site.com/search , or site.com/all-categories , etc. If you can .. point me out where exactly to do this, I will really appreciate it.

Thanks! :)
  •  

Marius

Hi,

You can use the sidebar.php ( https://github.com/PHPVibe/PHPVibe/blob/master/themes/main/sidebar.php ) or tpl.footer.php files for the links.
Depending on where you want to place the link.

As for php in the pages, you can modify the

https://github.com/PHPVibe/PHPVibe/blob/master/views/page.route.php
and corresponding theme files
https://github.com/PHPVibe/PHPVibe/blob/master/themes/main/default.php

to add php to specific pages (you can target them by id).

Otherwise...storing php in SQL and executing it will prove challenging  https://stackoverflow.com/questions/41406/how-do-i-execute-php-that-is-stored-in-a-mysql-database
If this helped, consider buying me a coffee.
20 years coding, tweaking, building in PHP. Still creating!
  •  

IceyTopic starter

Quote from: Marius P. on As for php in the pages, you can modify the

https://github.com/PHPVibe/PHPVibe/blob/master/views/page.route.php
and corresponding theme files
https://github.com/PHPVibe/PHPVibe/blob/master/themes/main/default.php

to add php to specific pages (you can target them by id).


I tried and..tried and..tried this approach and couldn't make it work. Can you please specify what exactly should I need to change?
Thanks!
  •  

IceyTopic starter

It took all Sunday to come up with a fix to also allow .php files to be writen but .. couldn't find a way! :(

Any help will be really appreciate it.

Thanks.

PS: What's the reason behind this approach ? Security? At least it should be allowed by Admins to write both html and php.
  •  

Marius

No CMS allows php in posts, it's a complicated and highly insecure process that I have never done (so I can't advise on it).
If this helped, consider buying me a coffee.
20 years coding, tweaking, building in PHP. Still creating!
  •  

IceyTopic starter

Made a..provisory additional to allow a "hardcoded" Page to accept php. Not happy about it but .. it is what it is! :)

If you can code it to allow admins at least to create additional pages, it will be nice, beause I couldn't do this :

As for php in the pages, you can modify the

https://github.com/PHPVibe/PHPVibe/blob/master/views/page.route.php
and corresponding theme files
https://github.com/PHPVibe/PHPVibe/blob/master/themes/main/default.php

to add php to specific pages (you can target them by id).


..no matter how hard I tried!
  •  

Marius

QuoteIf you can code it to allow admins at least to create additional pages

Not sure what you are saying here. You can always create additional pages from Admin -> Text pages -> Pages by clicking "New page", the green button in the top right. If that's what you're asking...
If this helped, consider buying me a coffee.
20 years coding, tweaking, building in PHP. Still creating!
  •  

Similar topics (7)