How to use executable php in posts
- Edi
- Site Admin
- Posts: 3121
- Joined: Sun Aug 09, 2015 5:01 pm
- Location: Zurich
- Has thanked: 54 times
- Been thanked: 77 times
- Contact:
If you really need (?) [exec] [/exec] you have to use the heavy weight Content Management System (CMS) with this sort of code. Or write your own plugin.
As I wrote before you also can modify existing templates or code your own. This is easy for somebody who knows how to use PHP (otherwise also [exec] [/exec] makes no sense...).
Beside this, the fundamental concept of any CMS is to separate content from code and style.
Clickwork - Websites mit Bludit | Planet Bludit - Tipps und Snippets
I use heavyweight CMS, and there is no this feature too, I'm using workaround for WP, which takes 20 strings of code in 1 php file.
Maybe someone can write code better than us, and will share some?
Maybe someone can write code better than us, and will share some?
yes, I really need. And as I wrote before, modifying template can't give this feature, that I need.Edi wrote: ↑Mon Jun 11, 2018 12:41 pmIf you really need (?) [exec] [/exec] you have to use the heavy weight Content Management System (CMS) with this sort of code. Or write your own plugin.
As I wrote before you also can modify existing templates or code your own. This is easy for somebody who knows how to use PHP (otherwise also [exec] [/exec] makes no sense...).
- Edi
- Site Admin
- Posts: 3121
- Joined: Sun Aug 09, 2015 5:01 pm
- Location: Zurich
- Has thanked: 54 times
- Been thanked: 77 times
- Contact:
In this case we have to know what the code executes, and why it is not possible using a template. And: Why PHP is needed and it cannot be done using JavaScript or jQuery.
By the way: You also can use iFrames as part of the content, despite it's not best practice.
Clickwork - Websites mit Bludit | Planet Bludit - Tipps und Snippets
the code executes wide range of tasks, from "hello world" and phpinfo(); to asking number of different API's and generating some output. It can not be implemented by using template, forget about it.
Iframes? Are you serious?
- Edi
- Site Admin
- Posts: 3121
- Joined: Sun Aug 09, 2015 5:01 pm
- Location: Zurich
- Has thanked: 54 times
- Been thanked: 77 times
- Contact:
Again: Bludit is a CMS not a PHP framework.
If you are a developer it's no proplem to add own plugins.
In the documentation is also an example for a plugin to display "Hello World" in the sidebar:
https://docs.bludit.com/en/plugins/plug ... ello-world
If you are a developer it's no proplem to add own plugins.
In the documentation is also an example for a plugin to display "Hello World" in the sidebar:
https://docs.bludit.com/en/plugins/plug ... ello-world
Clickwork - Websites mit Bludit | Planet Bludit - Tipps und Snippets
- bayerberg
- Master Bludit
- Posts: 141
- Joined: Wed Jun 07, 2017 1:05 pm
- Location: London, UK
- Has thanked: 9 times
- Been thanked: 10 times
- Contact:
you can do it automatically based on the category or tags of the page you want to spice up
categories - you can do it based on category name or slug. something as simple as
or
tags - this might be a bit fiddly, if you have multiple tags with multiple scripts assigned to them there might be a bit of a mess if those scripts wont play nicely with each other. QA a must
categories - you can do it based on category name or slug. something as simple as
Code: Select all
if ($page->category()) {
if ($page->category()=="Category Name Here") {
// your code here
}
}
Code: Select all
if ($page->category()) {
if ($page->categoryKey()=="cat-slug-here") {
//your code here
}
};
Code: Select all
if ($page->tags()) {
foreach ($tags as $tagKey=>$tagName) {
if ($tagKey=="tag-slug-here") {
// your code here
}
}
}