Is this type of expression possible?
exp:weblog:entries weblog=“segment_2”
or is there another way that I can automatically select a weblog by url
eg if url = mydomain.com/tennis then weblog = tennis
Thanks Steve
This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.
The active forums are here.
February 03, 2011 4:39pm
Subscribe [3]#1 / Feb 03, 2011 4:39pm
Is this type of expression possible?
exp:weblog:entries weblog=“segment_2”
or is there another way that I can automatically select a weblog by url
eg if url = mydomain.com/tennis then weblog = tennis
Thanks Steve
#2 / Feb 04, 2011 9:49am
Hi, stevealfa.
Sure. You’d need to have your weblog named the same thing as your segment name.
So you’d do something like this:
{exp:weblog:entries weblog="{segment_2}"}
...
{/exp:weblog:entries}Does that help?
#3 / Feb 04, 2011 10:33am
Hi Sue,
That’s great - works exactly how I want.
Also I found one of your other posts about embedded variables which will help me when the weblog does not match the url eg
{embed="globals/_master" section_weblog="football"}and then in the _master template
{exp:weblog:entries weblog="{embed:section_weblog}"}
...
{/exp:weblog:entries}Thanks
PS Thanks Greg for the reminder to use curly brackets - I have corrected the code above just in case someone tries to use it 😊
#4 / Feb 05, 2011 1:55pm
Hi Steve,
Glad that Sue was able to help you with this. For your _master template example don’t forget that the embed variable has be to surrounded by curly braces. Please post back if required.
Cheers
Greg