Replies: 1 comment 3 replies
-
Templates use shortcode to fill in the blanks and generate the HTML for the data shown. Shortcode should be used for gathering and parsing data. Shortcode files should have very little HTML only where needed (eg an element that needs an ID or data-attributes that you don't want to be lost when someone else makes or alters the template. It is possible to do, but I think it is redundant. I started writing a long and complicated demo code but it got wiped out by accident. I started writing again and realized that it was giving me a headache (the code ends up recursive) - so what you are asking for is probably not a good practice. I have just updated my estate plugin and you might want to peek at the following files:
Now to your problem:
You can use the $GLOBALS variable inside the shortcode function, just be sure the files are called in the correct order in your whatever.php file. Let's say you have a template
and in your shortcode:
and finally in your whatever.php file:
You see, it is like trying to put the horse between two carts... |
Beta Was this translation helpful? Give feedback.
-
Is there anyway it's possible to use the e107::getTemplate function inside a shortcode sc_ definition code?
I tryed and it didn't worked...
To make it work i have to declare the $template variable already loaded in the main code as global.... 😢
Beta Was this translation helpful? Give feedback.
All reactions