Jump to content

Recommended Posts

[!--quoteo(post=354950:date=Mar 14 2006, 05:06 PM:name=gig)--][div class=\'quotetop\']QUOTE(gig @ Mar 14 2006, 05:06 PM) [snapback]354950[/snapback][/div][div class=\'quotemain\'][!--quotec--]
How I can use macros in PHP code - the goal is to substitute %piece1 with block of code or function call. I need for following task - to include different piece of code based on situation. Thanks in advance.
[/quote]

[code]if ($condition) {
  include ("grandma");
} else {
  include ("grandpa");
}[/code]
[!--quoteo(post=355059:date=Mar 14 2006, 04:25 PM:name=keeB)--][div class=\'quotetop\']QUOTE(keeB @ Mar 14 2006, 04:25 PM) [snapback]355059[/snapback][/div][div class=\'quotemain\'][!--quotec--]
[code]if ($condition) {
  include ("grandma");
} else {
  include ("grandpa");
}[/code]
[/quote]

Dear keeB,

1. Thank you.

2. I think, I asked wrong - what I really need is to use not runtime variables (like you suggested) but MACROS (by stating this I assumed like parser/preprocessor). So, last night I did some research via search engines and found that some preprocessor software exists that could possible help me with this.

I raised question because I am not programmer (in PHP or so) - I just bought CMS where php mixed with html and I realized that in order to separate my own additions (in design or so)
from existing CMS code I need some parser/preprocessor to keep all organized.

3. So, if you have some experience in such things, please help me sharing with. Anyway, looks like i need preprocessor software for my purpose.

Best regards, Ian
[!--quoteo(post=355405:date=Mar 15 2006, 12:30 PM:name=thorpe)--][div class=\'quotetop\']QUOTE(thorpe @ Mar 15 2006, 12:30 PM) [snapback]355405[/snapback][/div][div class=\'quotemain\'][!--quotec--]
What your looking for sounds more like a templating system. If the CMS you have doesn't have one then it would be pretty difficult to encorperate without knowing php, but there are plenty of templating engines around. Some simple, some quite advanced.
[/quote]

Well, CMS I got has templating system (and macros - as its written on PHP) already. Plus studying PHP a little last night I found way how to add additional conditional inserts via PHP functions calls in my CMS - like what you suggested in the beginning.

And finally I found the solution - this is PPWizard - preprocessor that have enough power to cover my needs.

Big thanks for last link ;-)
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.