I am creating my own UDT and am having trouble figuring out how I can access the current page alias.
What really would be helfpul is any type of documentation that would list out everything that is available in the $GLOBALS['gCms'] array because ultimately I would like to use the full-path to the current file for a custom form that I am creating.
For example if I could figure out this full path, http://www.domain.com/contact/form/, from inside the tag if the 'form' page is the current page that I am on it would make life easier.
If that makes sense, any help would be appreciated. If you need some clarification, just let me know.
Accessing current page alias in a userdefined tag
Re: Accessing current page alias in a userdefined tag
You could give
{get_template_vars} on a content-page to see all passed variables.
I used the "mailtofriend"-tag to pass the referer-URL in the message-subject. The code initially passed the current-page (your request), but that would put the page on which te mailtofriend-tag was shown instead of request.
Ronny
I think that things like currenturl, referer etc... are existing PHP-parameters, that can be called without real scrpting required. If you chec:
http://www.phpfreaks.com/PHP_Reference/ ... bles/8.php
you'll find some usefull predefined variables.
{get_template_vars} on a content-page to see all passed variables.
I used the "mailtofriend"-tag to pass the referer-URL in the message-subject. The code initially passed the current-page (your request), but that would put the page on which te mailtofriend-tag was shown instead of request.
Ronny
I think that things like currenturl, referer etc... are existing PHP-parameters, that can be called without real scrpting required. If you chec:
http://www.phpfreaks.com/PHP_Reference/ ... bles/8.php
you'll find some usefull predefined variables.
Re: Accessing current page alias in a userdefined tag
I guess that is a good point. So far, I've noticed whenever I try to do a bit more coding I eventually find out that there already is some pre-existing code to do what I was trying in CMSMS. While it makes me feel not all that smart, it does reinforce the community for sure.RonnyK wrote: I think that things like currenturl, referer etc... are existing PHP-parameters, that can be called without real scrpting required. If you chec:
http://www.phpfreaks.com/PHP_Reference/ ... bles/8.php
you'll find some usefull predefined variables.
Re: Accessing current page alias in a userdefined tag
You might check here for some standard PHP-variables.
http://www.phpfreaks.com/PHP_Reference/ ... bles/8.php
You might have to combine two variables to get the complete set. But basically thez
Ronny
http://www.phpfreaks.com/PHP_Reference/ ... bles/8.php
You might have to combine two variables to get the complete set. But basically thez
Ronny
Last edited by RonnyK on Tue Mar 27, 2007 11:47 am, edited 1 time in total.
-
- Support Guru
- Posts: 8169
- Joined: Tue Oct 19, 2004 6:44 pm
Re: Accessing current page alias in a userdefined tag
the $page_alias variable in smarty contains the current page alias.
To access this within a UDT, you'd do this:
To access this within a UDT, you'd do this:
Code: Select all
global $gCms;
$smarty =& $gCms->GetSmarty();
$page_alias = $smarty->get_template_vars('page_alias');
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Re: Accessing current page alias in a userdefined tag
As I suspected, it was built in already. Thankscalguy1000 wrote: the $page_alias variable in smarty contains the current page alias.
To access this within a UDT, you'd do this:
Code: Select all
global $gCms; $smarty =& $gCms->GetSmarty(); $page_alias = $smarty->get_template_vars('page_alias');
