Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Outside Links in Navigation
#1
Not sure if it is just me or the search, but I am having a difficult time finding anything.

As it is, I am attempting to create a navigation link that goes to an outside website/new window.

For example, the top navigation bar in the default theme. I want to add another button, but this button needs to go outside of the site, I do not want to create a new page for this.

Am I missing a setting somewhere that may allow me to do this?

Also, if this question has been answered please link me the post since my search skills appear to be weak lately. Thanks all.
Reply
#2
When the navigation list is generated by GetSimple it uses only the pages that are created with GetSimple. People have been coming up with different ways to add more items into the menu. It’s hard to search the forum for those two methods by users, because not all topic titles are very descriptive.
“Don’t forget the important ˚ (not °) on the a,” says the Unicode lover.
Help us test a key change for the core! ¶ Problems with GetSimple? Be sure to enable debug mode!
Reply
#3
Zegnåt Wrote:When the navigation list is generated by GetSimple it uses only the pages that are created with GetSimple. People have been coming up with different ways to add more items into the menu. It’s hard to search the forum for those two methods by users, because not all topic titles are very descriptive.

I went with Option 3, seemed the best/easiest way. I attempted Option 1 with little success. Formatting did not carry over properly for the nav ID.

I am still fairly new to PHP, would there be anything I can add in there that would be the equivalent to target="_blank" for a standard href?
Reply
#4
Hello,
other way of doing it, is directly in index.php. Putting the following, for example:

Code:
if ($file == "data/pages/yourfile.xml") {
        header ('Location:/myfolder/index.html');
      <!-- or         header ('Location:http://youurl');  -->
      
        exit;
}

I know that this solution is not very pretty, but works well.

This code must be putting after :
Code:
# if page does not exist, throw 404 error
if ($url == '403') {
    header('HTTP/1.0 404 Not Found');

Regards.
Reply
#5
GetSimple Wrote:I went with Option 3, seemed the best/easiest way. I attempted Option 1 with little success. Formatting did not carry over properly for the nav ID.

:-? About option 1 (which I believe is the easier one), editing your template.php to have something like this should work fine:

Code:
<ul id="nav">
            <?php get_navigation(return_page_slug()); ?>
            <li><a href="http://external.link" target="_blank">link</a></li>
        </ul>

With option 1 you don't need to create any GS page nor have to patch the core (as with option 3)... However, if you select another theme the added link(s) would disappear. And you can only add links at the beginning or end of the menu.
Reply
#6
Zegnåt Wrote:It’s hard to search the forum for those two methods by users, because not all topic titles are very descriptive.

Besides the forum search engine, I usually try to google "site:get-simple.info keywords"
Reply
#7
Carlos Wrote::-? About option 1 (which I believe is the easier one), editing your template.php to have something like this should work fine:

Code:
<ul id="nav">
            <?php get_navigation(return_page_slug()); ?>
            <li><a href="http://external.link" target="_blank">link</a></li>
        </ul>

With option 1 you don't need to create any GS page nor have to patch the core (as with option 3)... However, if you select another theme the added link(s) would disappear. And you can only add links at the beginning or end of the menu.

In trying the above code the issue I ran into is the CSS formatting did not carry over properly. In looking back though I applied the CSS nav property to the href tag and not the li tag. I may retry it.

In regards to option 3 and the navigation location, the choice of where the link is will be set, if I understand correctly as I haven't tested, with the page level of the page that was created in the page options. Setting it to 20 should movie it to the end (as I did), so setting to 1 or anywhere in between I would think would move it to the correct location. As I said though, I have not tested this.

As for the patch to the core, I can see your point here. If I had other people other than I working on this then I may look into a different path other than this option. Since I am the only person and this link may not be a permanent feature, I am finding this to be the quickest way for me at the moment. I am still learning GS and how it works though so all this can easily change in the near future.

I am just glad for the quick feedback and support here. It has been very helpful and solidified my choice in using this package.

Also Carlos, I think I will use your search suggestion. The built in search has been less than friendly, especially with the 30 second timer between searches required.

Thanks for the help!
Reply
#8
The I18N plugin now supports external links (anywhere in the navigation, no patching, just simple), see here.
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply




Users browsing this thread: 3 Guest(s)