I would like to be able to have some way to get the url of a page with certain alias, or ID. I would like to be able to specify an alias/id and then get the url of that page.
Thanks in advance.
Isaac.
how to get the url of a specified page from its alias or id [SOLVED]
how to get the url of a specified page from its alias or id [SOLVED]
Last edited by isaacd on Sun Feb 21, 2010 8:22 pm, edited 1 time in total.
Re: how to get the url of a specified page from its alias or id
not sure exactly what you're asking.
if your page alias is "home", then the url for that page is
http://www.yourdomain.tld/index.php?page=home
or, if you're using pretty URLs
http://www.yourdomain.tld/home.html (or .php, or .whatever)
I'm assuming you already know all of this, and are looking for something else, but I'm not sure what...
if your page alias is "home", then the url for that page is
http://www.yourdomain.tld/index.php?page=home
or, if you're using pretty URLs
http://www.yourdomain.tld/home.html (or .php, or .whatever)
I'm assuming you already know all of this, and are looking for something else, but I'm not sure what...
Re: how to get the url of a specified page from its alias or id
I have pretty URLs set up like this:
-Hierarchy enabled
-No page extension
I would like to be able to get the url of a page simply by providing an alias. I would like the url to include the hierarchy. Conceptually, something like this:
{get_page_url alias="mission" assign="$url"}
{$url}
And then that would display this:
http://www.trilliumcharterschool.org/about/mission
I would just add the page alias on the end of http://www.trilliumcharterschool.org but I need hierarchy in the url (ie in the example above, I need /about before /mission).
-Hierarchy enabled
-No page extension
I would like to be able to get the url of a page simply by providing an alias. I would like the url to include the hierarchy. Conceptually, something like this:
{get_page_url alias="mission" assign="$url"}
{$url}
And then that would display this:
http://www.trilliumcharterschool.org/about/mission
I would just add the page alias on the end of http://www.trilliumcharterschool.org but I need hierarchy in the url (ie in the example above, I need /about before /mission).
Re: how to get the url of a specified page from its alias or id
If you have the alias already at hand, why not use cms_selflink?
E.g.
This will generate a link to the corresponding page, using the CMSMS hierarchy settings. It is also possible to only receive the href value or to specify the text used for the link. E.g.
Just check the information that comes with the tag. It will tell you about the options available - it's a very versatile tag.
Best
Nils
E.g.
Code: Select all
{cms_selflink page=$the_alias}
or
{cms_selflink page="mission"}
Code: Select all
{cms_selflink href="mission"}
Best
Nils
Re: how to get the url of a specified page from its alias or id
I am not looking for a link, I am looking for a variable, so I can use an if statement. Something like this:
{if $url == "blah"}
do something
{else}
do something else
{/if}
This has to be a URL. I can not use an alias.
Thanks.
{if $url == "blah"}
do something
{else}
do something else
{/if}
This has to be a URL. I can not use an alias.
Thanks.
Last edited by isaacd on Sun Feb 21, 2010 12:04 am, edited 1 time in total.
Re: how to get the url of a specified page from its alias or id
Then use the 'href' parameter and use {capture} if you need it in a variable.
Re: how to get the url of a specified page from its alias or id
Or use the assign parameter of the cms_selflink tag
again, most of the core tags and module and many other tags and module have enough documentation to get things going. Please read such stuff.
Best
Nils
Code: Select all
{cms_selflink href="mission" assign="what"}
{if $what== "http://...."}
do something
{else}
do something else
{/if}
Best
Nils
Re: how to get the url of a specified page from its alias or id
{cms_selflink href="the page" assign="url"} worked for me. Thanks.