1 question, why
I have things organised into folders and there are two sections to the site. Each section has a sub head and then a work section and then the 1st page of the work page. There are times I want the name of the page to appear in teh nav but the nav itself to go to the first page.
However there is one instance when I want it to go to the second page. There probably is an easier way...
See the screen grab 'Image Gallery', 'Hemptech', 'Croxley' etc are sections and they need to be.
WORK is in the top nav but needs to go straight to Komaru in 'Image gallery'.
However there is one instance when I want it to go to the second page. There probably is an easier way...
See the screen grab 'Image Gallery', 'Hemptech', 'Croxley' etc are sections and they need to be.
WORK is in the top nav but needs to go straight to Komaru in 'Image gallery'.
The easiest way is to create a page attribute named direct_link_url
Then dup the autonav block and when looping thru the links rewrite the page link variable to the one set in the attribute if it exists.
Let me know if you need the code. I have already done this a few times
-John
Then dup the autonav block and when looping thru the links rewrite the page link variable to the one set in the attribute if it exists.
Let me know if you need the code. I have already done this a few times
-John
Hey Thanks, if you could supply the code that would be fantastic.
I might also learn something if I can see how it works.
NIge
I might also learn something if I can see how it works.
NIge
Try this link as I don't have the code handy right now
http://www.concrete5.org/community/forums/customizing_c5/replace_na...
Scroll to bottom and download the code attached
-John
http://www.concrete5.org/community/forums/customizing_c5/replace_na...
Scroll to bottom and download the code attached
-John
Hey thanks Dude,
just one question.
I have a custom template called alt_view.
It's already modified to accomodate nav-path selected. Get collectionPath instead of ID.
Do I just paste in the snippet you added in that link you directed me to, then add the direct_link_ url attribute and it will work?
As long as the attribute handle is correctly defined in the snippet I guess.
Nige
just one question.
I have a custom template called alt_view.
It's already modified to accomodate nav-path selected. Get collectionPath instead of ID.
Do I just paste in the snippet you added in that link you directed me to, then add the direct_link_ url attribute and it will work?
As long as the attribute handle is correctly defined in the snippet I guess.
Nige
Yes, that right
In the example i have called the page attribute 'external_link'
If you place this code just above the section where you are echoing out the $pageLink, all should work perfectly.
We are just testing for an attribute and if true redirecting to the custom url. So now on the page that you want redirected, you'll be setting the adding the attribute and specifically directing to any link within the website
-John
In the example i have called the page attribute 'external_link'
If you place this code just above the section where you are echoing out the $pageLink, all should work perfectly.
$externalLink = $_c->getAttribute('external_link'); if ($externalLink == true) { $pageLink = $externalLink; }
We are just testing for an attribute and if true redirecting to the custom url. So now on the page that you want redirected, you'll be setting the adding the attribute and specifically directing to any link within the website
-John
Thanks John, I found your other post on this as well, so I should be able to sort it out!! hahah.
It's brilliant thanks a lot for your help. Karma points!
I've just thought though. I've made a checkbox attribute but if I need to put in a custom attribute it will need to be manually entered right? Textbox attribute?
Nige
It's brilliant thanks a lot for your help. Karma points!
I've just thought though. I've made a checkbox attribute but if I need to put in a custom attribute it will need to be manually entered right? Textbox attribute?
Nige
You will probably need to make it a text attribute, as to allow the most customization and reusability
Thanks for the Karma!
Thanks for the Karma!
I've done everything but its not working.
1.I've added the code to the alt.view autonav template. (see screen shot)
2.I've created a custom attribute with handle external_link. Its a text box and I've added the url I want the redirect to go to. (see screen shot)
It's not working though. Do I need another checkbox attribute or something to turn it on??
Nige
1.I've added the code to the alt.view autonav template. (see screen shot)
2.I've created a custom attribute with handle external_link. Its a text box and I've added the url I want the redirect to go to. (see screen shot)
It's not working though. Do I need another checkbox attribute or something to turn it on??
Nige
You don't need another attribute to turn it on.
Just to be sure you have put this code in the blocks/autonav/templates folder and you are setting this custom template in your view...
John
Just to be sure you have put this code in the blocks/autonav/templates folder and you are setting this custom template in your view...
John
Yup I've done that. Do the screenshots look right to you?
N
N
And here it is step by step. Thanks John.
1/ Make a custom template of your auto nav block. Using your ftp client or whatever copy the view.php file from concrete/blocks/autonav and paste it into root/blocks/autonav/templates and call it alt_view.php or whatever you like. If these folders aren't in root/blocks, create them.
2/ Open alt_view.php and paste in the code highlighted in Johns post above above the part where it says $pageLink. (see screenshot)
3/ Go to Pages and Themes in your dashboard and click the attributes tab at the top. Choose Text type attribute and make the handle external_link. Name it Fred or something stupid (no name it something that makes sense to you). The handle is the important bit. Save the new attribute.
4/ In sitemap right click on the page you want to navigate FROM and select properties. In the drop down select your brand new attribute and put in the url you want to go TO.
5/ Now in all relevant autonav blocks on your site, go into edit mode, scroll down to custome template and select alt_view.php which will magically be there because you put it in the correct NEW folder (root/blocks/autonav/templates)
6/ Now it should be working. When you click on the link of the page that you added the attribute to, it should redirect to the url you specified.
If it doesn't go aback and double check everything.
Nige
1/ Make a custom template of your auto nav block. Using your ftp client or whatever copy the view.php file from concrete/blocks/autonav and paste it into root/blocks/autonav/templates and call it alt_view.php or whatever you like. If these folders aren't in root/blocks, create them.
2/ Open alt_view.php and paste in the code highlighted in Johns post above above the part where it says $pageLink. (see screenshot)
3/ Go to Pages and Themes in your dashboard and click the attributes tab at the top. Choose Text type attribute and make the handle external_link. Name it Fred or something stupid (no name it something that makes sense to you). The handle is the important bit. Save the new attribute.
4/ In sitemap right click on the page you want to navigate FROM and select properties. In the drop down select your brand new attribute and put in the url you want to go TO.
5/ Now in all relevant autonav blocks on your site, go into edit mode, scroll down to custome template and select alt_view.php which will magically be there because you put it in the correct NEW folder (root/blocks/autonav/templates)
6/ Now it should be working. When you click on the link of the page that you added the attribute to, it should redirect to the url you specified.
If it doesn't go aback and double check everything.
Nige
I believe you need to move the external link code down 4 lines. Let me know if that works.
and it's my bad. I didn't have to move the code.
I noticed that on one of the pages the autonav block wasn't using the correct template.
Thats brilliant. Thanks John.
Can moving a few lines of php down a few lines break or fix the programming? Thats a bit scary...
Nige
I noticed that on one of the pages the autonav block wasn't using the correct template.
Thats brilliant. Thanks John.
Can moving a few lines of php down a few lines break or fix the programming? Thats a bit scary...
Nige