I'm sure this is very simple but I can't work it out.
Let's say I have a page where I have buttons that relate to to different news categories.
News about dogs
News about cats
News about sheep
I have a news page "mynews"
with the tag {news category=x}
So when the user clicks on "News about dogs" I have a cms_selflink to mynews passing the parameter "Dogs" as x.
I hope this makes sense.
Thanks
Passing a parameter in a cms_selflink [solved]
-
- Forum Members
- Posts: 31
- Joined: Fri Oct 03, 2008 4:52 am
Passing a parameter in a cms_selflink [solved]
Last edited by triggersmith on Wed Aug 04, 2010 12:20 am, edited 1 time in total.
Re: Passing a parameter in a cms_selflink
Why not creating a page for each category and use cms_selflink to link to that page?
In this page you can use the page alias as news category:
{news category=$content_alias}
You could also use the browsecat param to list news catgories.
Each category will be a link that displays news articels of the selected category.
Another solution could be the param "urlparam" of the cms_selflink:
{cms_selflink page="mynews" urlparam="category=..."}
This will link to your news page with an additional variable "category".
You now can call your news like this:
{news category=$smarty.get.category}
In this page you can use the page alias as news category:
{news category=$content_alias}
You could also use the browsecat param to list news catgories.
Each category will be a link that displays news articels of the selected category.
Another solution could be the param "urlparam" of the cms_selflink:
{cms_selflink page="mynews" urlparam="category=..."}
This will link to your news page with an additional variable "category".
You now can call your news like this:
{news category=$smarty.get.category}
-
- Forum Members
- Posts: 31
- Joined: Fri Oct 03, 2008 4:52 am
Re: Passing a parameter in a cms_selflink
Thanks for your reply.
I realise I can have a page for each category but I am expecting to have 50, 100 or even more news categories. It seems a bit silly to have that many pages with the only difference being the category. There has to be a more elegant way of doing it.
I don't want to use the browse category option because I want the main page to be a business logo with a direct link to their news (category).
I will try you other suggestion and report back.
As an aside there seems to be soo many features of CMS MS (which I love BTW) that have very little info on how to use them, examples etc.
Like for instance the additional page parameters which I though may have been a solution here.
Thanks again, I'll get back.
Paul
I realise I can have a page for each category but I am expecting to have 50, 100 or even more news categories. It seems a bit silly to have that many pages with the only difference being the category. There has to be a more elegant way of doing it.
I don't want to use the browse category option because I want the main page to be a business logo with a direct link to their news (category).
I will try you other suggestion and report back.
As an aside there seems to be soo many features of CMS MS (which I love BTW) that have very little info on how to use them, examples etc.
Like for instance the additional page parameters which I though may have been a solution here.
Thanks again, I'll get back.
Paul
-
- Forum Members
- Posts: 31
- Joined: Fri Oct 03, 2008 4:52 am
Re: Passing a parameter in a cms_selflink
OK I think I have this nearly working but I think there is a syntax problem or something.
This is my tag
{cms_selflink page="partner-news-detail" urlparam="category=Horses NZ" text="news"}
When I click on the news link in my browser it can't find the page. Here is the url I get:
http://mywebsite.co.nz/index.php?page=p ... orses%20NZ
It's like there is a separator missing between the page name and the param.
What have I done wrong here.
Thanks
This is my tag
{cms_selflink page="partner-news-detail" urlparam="category=Horses NZ" text="news"}
When I click on the news link in my browser it can't find the page. Here is the url I get:
http://mywebsite.co.nz/index.php?page=p ... orses%20NZ
It's like there is a separator missing between the page name and the param.
What have I done wrong here.
Thanks
-
- Support Guru
- Posts: 8169
- Joined: Tue Oct 19, 2004 6:44 pm
- Location: Fernie British Columbia, Canada
Re: Passing a parameter in a cms_selflink
urlparam='?foo=bar'
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.
-
- Forum Members
- Posts: 31
- Joined: Fri Oct 03, 2008 4:52 am
Re: Passing a parameter in a cms_selflink
I worked it out actuallycalguy1000 wrote: urlparam='?foo=bar'
urlparam="&foo=bar"
worked.
I presume following this syntax I could string a bunch of parameters like this:
urlparam="¶m1=x¶m2=y"
etc?
Yes I can have just tried this...awesome!!!!
Last edited by triggersmith on Wed Aug 04, 2010 12:21 am, edited 1 time in total.