I have a site where I am making extensive use of GCBs. The site is essentially split into five areas for five different audiences, but some of the core information gets repeated.
I created all the repeating information in global content blocks which has been great, but I have run into one problem. When a global content block contains a link, let's say to a contact page, how do I deal with that? I would like to do something context sensitive, so if they are in the teachers section, they see a global contact block that has a link to the contact page, that link appears to also be in the teachers section as opposed to the main site or the student section.
In a non CMS scenario, I would have used a basic include with a relative link, but I am not quite getting that same result with the global content blocks, the CMS Self Links appear to me to need to be directed at an actual page.
Thanks much.
Global Content Blocks and Links
-
versatility
- Forum Members

- Posts: 49
- Joined: Sun Sep 24, 2006 2:46 pm
-
calguy1000
- Support Guru

- Posts: 8169
- Joined: Tue Oct 19, 2004 6:44 pm
Re: Global Content Blocks and Links
scenario 1.... you have a different template for each 'section'
answer: a) in the page template (very close to the top) add {assign var='section' value='teachers'}
b) create a new contact page for each section, with the alias prefixed by the 'section' their in:
i.e: teachers_contact, students_contact, etc.
c) in the gcb that you want to do the logic
{capture assign='contactpage'}{$section}_contact{/capture}
{cms_selflink href="$contactpage}
scenario 2.... You're using the same template for all pages
answer: Same as above, except step 1. you'll need to put the {assign var='section' value='teachers'} (or whatever) into
the metadata section of each page.
answer: a) in the page template (very close to the top) add {assign var='section' value='teachers'}
b) create a new contact page for each section, with the alias prefixed by the 'section' their in:
i.e: teachers_contact, students_contact, etc.
c) in the gcb that you want to do the logic
{capture assign='contactpage'}{$section}_contact{/capture}
{cms_selflink href="$contactpage}
scenario 2.... You're using the same template for all pages
answer: Same as above, except step 1. you'll need to put the {assign var='section' value='teachers'} (or whatever) into
the metadata section of each page.
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.
-
versatility
- Forum Members

- Posts: 49
- Joined: Sun Sep 24, 2006 2:46 pm
Re: Global Content Blocks and Links
Thank you very much, I will be trying it out!
-
versatility
- Forum Members

- Posts: 49
- Joined: Sun Sep 24, 2006 2:46 pm
Re: Global Content Blocks and Links
I got this to work - the only hitch is that I had to wrap the cms selflink tag in actual to get it to be link and not text. Does that seem correct? This would be a much sleeker solution if I didn't have to edit each of those.
-
calguy1000
- Support Guru

- Posts: 8169
- Joined: Tue Oct 19, 2004 6:44 pm
Re: Global Content Blocks and Links
depends on how you were using cms_selflink.
if using it as {cms_selflink href='page_alias'} it only generates a URL. it's in the docs.
if using it as {cms_selflink href='page_alias'} it only generates a URL. it's in the docs.
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.
-
versatility
- Forum Members

- Posts: 49
- Joined: Sun Sep 24, 2006 2:46 pm
Re: Global Content Blocks and Links
I have read the docs, that is where I got the idea to wrap it in the tags to make a link. I use the self links all the time, what I am asking is when I use the code you laid out, it appears as text and not a link. In order to make it link I had to wrap href tags around it in html editor.if using it as {cms_selflink href='page_alias'} it only generates a URL. it's in the docs.
-
calguy1000
- Support Guru

- Posts: 8169
- Joined: Tue Oct 19, 2004 6:44 pm
Re: Global Content Blocks and Links
when using {cms_selflink href="blah"}, it generates a URL. To use it, you'd do something like:
whatever blah text blah I wanted blah in the blah link blah
whatever blah text blah I wanted blah in the blah link blah
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.
