current page URL
current page URL
i want to add social-bookmarks to my news section. to do that i need to be able to bring up the current page URL and title. title i can do, but hwo do i show the current page URL?
Re: current page URL
use the PHP variable ( http://ie2.php.net/reserved.variables.server ), you'll have to modify config.php to allow use of php in the template.
Code: Select all
$_SERVER['PHP_SELF']
--
Alan Ryan
Lead Developer
CodeCrunchers Internet Software Development - Ireland
http://www.codecrunchers.ie
Alan Ryan
Lead Developer
CodeCrunchers Internet Software Development - Ireland
http://www.codecrunchers.ie
Re: current page URL
Or create a new UDT php_self:aln_cms wrote: use the PHP variable( http://ie2.php.net/reserved.variables.server ), you'll have to modify config.php to allow use of php in the template.Code: Select all
$_SERVER['PHP_SELF']
echo $_SERVER['PHP_SELF'] ;
regards
blast
Re: current page URL
It also should be within the smarty variable $nodelist.
Use the plugin {get_template_vars} to see what vars are available in your template.
If the $nodelist is there use {$nodelist|print_r} to see what else varaibles are in that $nodelist.
With a foreach-loop you can filter all entries in that list:
If you are using several menus be sure to call that code above before the other menu is called because the next menu will override the $nodelist with the items that are in that menu.
Therefore you will not find the current menus url node.
Use the plugin {get_template_vars} to see what vars are available in your template.
If the $nodelist is there use {$nodelist|print_r} to see what else varaibles are in that $nodelist.
With a foreach-loop you can filter all entries in that list:
Code: Select all
{foreach from=$nodelist item=node}
{if $node->id==$content_id}{$node->url}{/if}
{/foreach}
Therefore you will not find the current menus url node.
-
- New Member
- Posts: 5
- Joined: Wed May 21, 2008 6:02 pm
- Location: Backwoods, Idaho
Re: current page URL
For folks like me who find this thread and are asking the same questions... I found this solution to be the one that worked.
I have the mod_rewrite for pretty urls and hierarchy switched on. I set up a UDT using this
and I named it pageurl
so when I use {pageurl} in my template, it spit out http://mydomain.com/category-name/product-name.php
Hope that helps.
I have the mod_rewrite for pretty urls and hierarchy switched on. I set up a UDT using this
Code: Select all
echo $_SERVER['REQUEST_URI'];
so when I use {pageurl} in my template, it spit out http://mydomain.com/category-name/product-name.php
Hope that helps.
Re: current page URL
if you need a really url of your location.. something like this is what you want..
UDT- RealURL
so what this does is give you pURL of the module your in ie products or what not.. sometime you just can use the geturl provided by CMSMS, or by simple using the $_SERVER['REQUEST_URI']; .. just thought I'd point that out.. hope this helps..
Cheers -Jeremy
UDT- RealURL
Code: Select all
global $gCms;
$urlBASE = "http://".$_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME'];
if (!empty($_SERVER["QUERY_STRING"]))
$urlBASE .= "?".$_SERVER['QUERY_STRING'];
if (isset($gCms->config['assume_mod_rewrite']) && ($gCms->config['assume_mod_rewrite']==true)) {
$urls = str_replace("index.php?page=", "", $urlBASE);
$urls = str_replace("index.php", "", $urls);
}else{
$urls = $urlBASE;
}
echo $urls;
Cheers -Jeremy
Re: current page URL
There is also: {$cgsimple->self_url($assign)} in the CGSimpleSmarty module.
If all else fails, use a bigger hammer.
M@rtijn wrote: This is a community. This means that we work together and have the same goal (a beautiful CMS), not that we try to put people down and make their (voluntary) job as difficult as can be.
-
- Forum Members
- Posts: 26
- Joined: Wed Mar 29, 2006 4:08 pm
Re: current page URL
Perfect! This is the correct solution! Thank you!buffalokill wrote:For folks like me who find this thread and are asking the same questions... I found this solution to be the one that worked.
I have the mod_rewrite for pretty urls and hierarchy switched on. I set up a UDT using this
and I named it pageurlCode: Select all
echo $_SERVER['REQUEST_URI'];
so when I use {pageurl} in my template, it spit out http://mydomain.com/category-name/product-name.php
Hope that helps.
I used this in facebook comments-system when the facebook-plugin wants the current href.