We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Development question: Parse template code in CP?

Development and Programming

TonyNibbles's avatar
TonyNibbles
98 posts
16 years ago
TonyNibbles's avatar TonyNibbles

Hey,

I’m developing a module which stores different settings for its output and I’d like to enable a ‘preview’ section within the module.

Is there anyway I can parse the template code within the CP?

This sounds horribly horrid and wrong so I’m not expecting much luck here but if anyone has any ideas, much appreciated.

       
Laisvunas's avatar
Laisvunas
879 posts
16 years ago
Laisvunas's avatar Laisvunas

Hi Tony,

You are not alone.

I also have an extension which stores different settings (weblog URL templates) and I need to run strings saved as settings through full template engine.

I do not know if it is possible; for me it does not sound neither wrong nor weird.

There should be experienced add-on developers who know the answer. Perhaps, we should ask Leevi Graham?

       
silenz's avatar
silenz
1,648 posts
16 years ago
silenz's avatar silenz

To give you a starting point:

require PATH_CORE.'core.template'.EXT;
$TMPL = new Template();
$TMPL->run_template_engine($group_name, $template_name);
$result = $TMPL->final_template;
       
Laisvunas's avatar
Laisvunas
879 posts
16 years ago
Laisvunas's avatar Laisvunas

Hi silenz,

Thank you very much! Your answer will be really helpful.

       
Rob Sanchez's avatar
Rob Sanchez
335 posts
15 years ago
Rob Sanchez's avatar Rob Sanchez

silenz, I tried your method here, but it’s not parsing exp:weblog:entries, any idea why?

thanks!

       
Laisvunas's avatar
Laisvunas
879 posts
15 years ago
Laisvunas's avatar Laisvunas

Hi zortho,

I also tried this method and experimented with it in various ways but without success.

It seems that it is impossible to run strings saved as extension’s settings through full EE template engine.

My solution was this: to create just for particular extension - Entry Crumblink - a small template engine which will parse all needed tags and variables.

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.