'calling' a template from a template...

A general technical discussion area for patTemplate.
Locked
User avatar
ianmac
Joomla! Virtuoso
Joomla! Virtuoso
Posts: 4784
Joined: Sat Sep 24, 2005 11:01 pm
Location: Toronto, Canada

'calling' a template from a template...

Post by ianmac » Wed Aug 30, 2006 2:34 pm

Hey,

I've been using patTemplate in a component I'm working on.  I mentioned this in another thread, but haven't received any comments on it, so I will ask it again here.

I guess the first question I should ask is this:
Should I generate my links in my template or in my php code?  Right now, I'm employing the following method: I pass a global variable to my template called (a couple actually) BASE_LINK_URL, BASE_IMAGE_URL, etc...  these variables provide the base url for my links.  Then, depending on where I want to link to, I add on my appropriate task and view information.

Is this a recommended way of doing it?  It is working okay in the current setup...


BUT...
now I would like to provide SEF functionality...  usually this would require a SEFReltoabs or whatever the function is to make the URL SEF friendly...  what I would really like to see is the ability to implement a somewhat customized SEF for the component specific part of the URL...  so, I am writing a calendar application, and currently the URL looks like:
http://127.0.0.1/joomla11/index.php?opt ... 60901  (I know...  I need to add the itemid in there...)

It would be great if I could get it to look like:
http://127.0.0.1/joomla11/com_extcalend ... t/20060901
or at least get something like:
http://127.0.0.1/joomla15/component/opt ... t/20060901

So my question is, how do I go about doing this in patTemplate?

I would like to have a template such as:



  {LINK_TEXT}


  {LINK_TEXT}



and then link somewhere with something like:



Is there any way to implement something like this?  What is the best way of going about this?

Ian

Alejo
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 220
Joined: Fri Aug 19, 2005 12:28 pm
Contact:

Re: 'calling' a template from a template...

Post by Alejo » Wed Aug 30, 2006 11:06 pm

I know there's a sef modifier which allows to run sefreltoabs in the template, but I have not tried it.
https://www.jreviews.com/joomla directory, classifieds, and reviews system for Joomla and WordPress

User avatar
ianmac
Joomla! Virtuoso
Joomla! Virtuoso
Posts: 4784
Joined: Sat Sep 24, 2005 11:01 pm
Location: Toronto, Canada

Re: 'calling' a template from a template...

Post by ianmac » Thu Aug 31, 2006 3:44 pm

Thanks,

I'll look into that when I get a chance to see exactly how it works!

Thanks again for the tip!
Ian

Alejo
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 220
Joined: Fri Aug 19, 2005 12:28 pm
Contact:

Re: 'calling' a template from a template...

Post by Alejo » Fri Sep 15, 2006 9:11 pm

I finally got around to trying this and it works!

Just do this:

index.php?option=com_...">My sef link
https://www.jreviews.com/joomla directory, classifieds, and reviews system for Joomla and WordPress

dynedain
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 200
Joined: Wed Aug 24, 2005 7:20 pm
Location: Los Angeles
Contact:

Re: 'calling' a template from a template...

Post by dynedain » Mon Sep 18, 2006 4:35 pm

Alejo wrote: I finally got around to trying this and it works!

Just do this:

index.php?option=com_...">My sef link

But would this work?

index.php?optin=com_.....{PATVARIABLE}{ANOTHERVAR}">My sef link



I've run into other situations with patTemplate where the order of operations with regards to modifiers prevented me from what I was trying to do.

User avatar
ianmac
Joomla! Virtuoso
Joomla! Virtuoso
Posts: 4784
Joined: Sat Sep 24, 2005 11:01 pm
Location: Toronto, Canada

Re: 'calling' a template from a template...

Post by ianmac » Mon Sep 18, 2006 4:43 pm

That was my first question, but I think in this circumstance, it would be okay provided the sef function leaves the { } stuff alone...

Usually the values of these don't change, just the stuff around them, so we can process the { } after the SEF stuff and it should turn out okay, I think.  Does this make sense?

I've not tried it yet, I've been on a hiatus from development to work on the API docs.

Ian

Alejo
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 220
Joined: Fri Aug 19, 2005 12:28 pm
Contact:

Re: 'calling' a template from a template...

Post by Alejo » Mon Sep 18, 2006 5:10 pm

It works with variables as well.
https://www.jreviews.com/joomla directory, classifieds, and reviews system for Joomla and WordPress

dynedain
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 200
Joined: Wed Aug 24, 2005 7:20 pm
Location: Los Angeles
Contact:

Re: 'calling' a template from a template...

Post by dynedain » Mon Sep 18, 2006 5:17 pm

Alejo wrote: It works with variables as well.

I guess what I'm getting at, does the SEF string manipulation happen before or after the variable replacement?


Locked

Return to “patTemplate”