Thread Rating:
  • 2 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Non-Clickable Links for il8N Navigation?
#1
This plugin does the job and kicks arse!!!! Thanks mvlcek for all your work!! I have one question and I'm sure I'll have many more but is it possible to pin point any of the links printed out and make them non-links.

So something like this where any of these items simply do not have a page assigned only to hover to show other children links. Perhaps the parent link is not clickable but shows the children. Is this possible?

Parent Link
-----Child Link
-----Child Link
---------Child Child Link


Again, a huge thank your time!!!!

thanks
Lance
Reply
#2
(2013-05-25, 00:24:54)lnickel Wrote: This plugin does the job and kicks arse!!!! Thanks mvlcek for all your work!! I have one question and I'm sure I'll have many more but is it possible to pin point any of the links printed out and make them non-links.

So something like this where any of these items simply do not have a page assigned only to hover to show other children links. Perhaps the parent link is not clickable but shows the children. Is this possible?

You will need to use custom rendering and display a link or no link depending on $item->hasChildren.
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
#3
(2013-05-25, 01:58:11)mvlcek Wrote:
(2013-05-25, 00:24:54)lnickel Wrote: This plugin does the job and kicks arse!!!! Thanks mvlcek for all your work!! I have one question and I'm sure I'll have many more but is it possible to pin point any of the links printed out and make them non-links.

So something like this where any of these items simply do not have a page assigned only to hover to show other children links. Perhaps the parent link is not clickable but shows the children. Is this possible?

You will need to use custom rendering and display a link or no link depending on $item->hasChildren.

Thank you for your assistance!! I'm not sure how to implement that.

Currently I have :

Code:
<ul class="megamenu">
            <li><?php get_i18n_link('index');?></li>
    
            <li class="megamenu_drop"><?php get_i18n_link('about-us');?>
                <div class="dropdown_3columns dropdown_container">
                    <div>
                    <ul><?php get_i18n_navigation('about-us', 1, 100, I18N_SHOW_NORMAL); ?></ul>
                    </div>
                </div>
           </li>
....

I'm not sure how to implement the code you provide on your site:

Code:
<li class="<?php echo $item->classes; ?>">
  <a href="<?php echo htmlspecialchars($item->link); ?>">
    <?php echo htmlspecialchars($item->text); ?>
  </a>
  <?php if ($item->isOpen) { ?>
    <ul><?php $item->outputChildren(); ?></ul>
  <?php } ?>
</li>

get_i18n_navigation($slug, $minlevel=0, $maxlevel=0, $show=I18N_SHOW_NORMAL, $component=null)

What do I reference in the component var? I appreciate your help!!!!!
Reply
#4
So I take this code and make a component from it and call it it as a param in the get_nav function. Cool. Just dont know how to do the if/else

I've tried it but doesnt work.

Code:
<li class="<?php echo $item->classes; ?>">
  <?php if ($item->hasChildren) {
     <a href="<?php echo htmlspecialchars($item->link); ?>">
    <?php echo htmlspecialchars($item->text); ?>
  </a>

} else {
     <?php echo htmlspecialchars($item->text); ?>
} ?>

  <?php if ($item->isOpen) { ?>
    <ul><?php $item->outputChildren(); ?></ul>
  <?php } ?>
</li>

Heck I'm such a PHP noob its embarassing!!Big Grin

   

Here is what I'm trying to achieve. Some of the list items weather or not they are parent or child are not click-able.
Reply
#5
(2013-05-25, 06:18:58)lnickel Wrote: So I take this code and make a component from it and call it it as a param in the get_nav function. Cool. Just dont know how to do the if/else

PHP code between <?php and ?>, HTML outside:
Code:
<li class="<?php echo $item->classes; ?>">
  <?php if ($item->hasChildren) { ?>
     <a href="<?php echo htmlspecialchars($item->link); ?>">
       <?php echo htmlspecialchars($item->text); ?>
     </a>
  <?php } else { ?>
     <?php echo htmlspecialchars($item->text); ?>
  <?php } ?>

  <?php if ($item->isOpen) { ?>
    <ul><?php $item->outputChildren(); ?></ul>
  <?php } ?>
</li>

You could of course also write the else-part simply as
Code:
<?php } else { echo htmlspecialchars($item->text); } ?>
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
#6
Thanks mvlcek! I'll give it a try and see! Smile Thank you!!!


Update: I gave it a try and it worked. Can it get more granular than that?

Some links may have children but dont actually have it's own page.

Sorry for all the ?'s!!!!! I will keep hunting! Thanks for your input!
Reply
#7
Did you manage to do this, lnickel?

If not (or just as a reference for others hoping to do the same), you can use Custom Fields to create a custom status (like 'nopage') for pages in the menu that takes either the value 'true' or 'false'. Then to alter the appearance of pages in the menu that have children (but do not have their own pages) use a conditional statement like:

Code:
if($item->hasChildren && $item->nopage=='true') {
  // output
}
Reply
#8
(2013-05-30, 21:40:32)Angryboy Wrote: Did you manage to do this, lnickel?

If not (or just as a reference for others hoping to do the same), you can use Custom Fields to create a custom status (like 'nopage') for pages in the menu that takes either the value 'true' or 'false'. Then to alter the appearance of pages in the menu that have children (but do not have their own pages) use a conditional statement like:

Code:
if($item->hasChildren && $item->nopage=='true') {
  // output
}


Aw man Angryboy!!! You made me a happyBoy! I will try this in a jiffy! I was converting everything to wp....was frustrated! I will use this on my next project. Many thanks!!!
Reply
#9
Hope it's helpful. If you're feeling the urge to convert to WordPress again in the future due to any GetSimple frustrations, feel free to PM me. *smiles*

[For future reference: if you have plugin-specific queries, it is better to keep those questions in the support threads that the original authors publish.]
Reply
#10
(2013-05-31, 01:26:46)Angryboy Wrote: Hope it's helpful. If you're feeling the urge to convert to WordPress again in the future due to any GetSimple frustrations, feel free to PM me. *smiles*

[For future reference: if you have plugin-specific queries, it is better to keep those questions in the support threads that the original authors publish.]

Thanks angryboy. I was on a time constrained project and really wanted to use GS. As with anything there is a learning curve - I should of really taken that into consideration. I'm well versed into wp and themeing so I went back only because of the time Smile but teetering on just using GS....Smile I really want to just use GS for future projects because of the 'no-fuss' editing. I don't need that layer for management like clients do. Many thanks!!! Sorry for putting this in the wrong place! Smile
Reply
#11
Hello,
I would like non clickable only top level menu if I have a children.

I use in template:

Code:
<?php if(function_exists(get_i18n_navigation)){ get_i18n_navigation($slug, $minlevel=0, $maxlevel=2, $show=I18N_SHOW_MENU, $component=null); } else {  get_navigation(get_page_slug(FALSE)); }} ?>

Could you help me Smile
Reply
#12
Code:
<?php function_exists('get_i18n_navigation') ? get_i18n_navigation(return_page_slug(), 0, 100, I18N_SHOW_MENU) : get_navigation(return_page_slug()); ?>
Reply
#13
Thanks for code

(2014-11-28, 16:49:22)Oleg06 Wrote:
Code:
<?php function_exists('get_i18n_navigation') ? get_i18n_navigation(return_page_slug(), 0, 100, I18N_SHOW_MENU) : get_navigation(return_page_slug()); ?>

After my pasted also top level menu which has a children is clickable and is link.
Mayby I must change something in file frontend.class.php
Reply
#14
http://get-simple.info/forums/showthread...4#pid36754
http://mvlcek.bplaced.net/get-simple/mul...-rendering
Reply
#15
Try using the I18N Custom Fields.

1. Install the plugin
2. Create two fields - one with something like noPage for the name, noPage for the label and select the Type to be Dropdown. Give it two selections with the something like hasLink and no Link then save
3. Go to one of your pages and now you should be able to see those custom fields in the page options.
4. Go to components and input something like this into a new component and name it 'links'.
This will rewrite the general output of the il8n nav.

PHP Code:
<li class="<?php echo $item->classes; ?>">
    <?
php
          
if ($item->nopage == 'noLink') {
            echo 
htmlspecialchars($item->text);
    }
          elseif (
$item->nopage == 'hasLink') { ?>
             <a href="<?php echo htmlspecialchars($item->link); ?>">
                <?php echo htmlspecialchars($item->text); ?>
              </a>
        
          <?php }
          
          else { 
?>
             <a href="<?php echo htmlspecialchars($item->link); ?>">
                <?php echo htmlspecialchars($item->text); ?>
  </a>
      <?php }?>
          
        <?php if ($item->isOpen) { ?>
              <button class="toggleExpand"><i class="fa fa-arrow-circle-right"></i></button>
                <ul class="sub-menu"><?php $item->outputChildren(); ?></ul>
          <?php ?>
</li> 


5. Now in your navigation code in your template (if you are using I18N navigation) which you probably should be. Pass the 'links' param into that piece of code like this. This will give the option to turn off the link for the navigation via the page options. Its a per item thing.

PHP Code:
<?php get_i18n_navigation(return_page_slug(),0,100I18N_SHOW_MENU'links'); ?>
Reply
#16
Thank you very much. It works very nice Smile
Reply
#17
A similar way I do it that also uses I18N Custom Fields is I create a custom field called "redirect" and then structure the pages so that if the parent is supposed to link to the first child, then the parent page has no content but has the URL of the first child (either root-relative or absolute) in the "redirect" field. Then in the theme's template.php file, I add the following PHP before any HTML is output:

PHP Code:
<?php

if( return_custom_field'redirect' ) !== '' ){
  
header'HTTP/1.1 301 Moved Permanently' );
  
header'Location: ' return_custom_field'redirect' ) );
  exit();
}

?>

This is also a little more flexible as you can add external links to your primary navigation too using this method.
Modern UI Admin for GetSimple
Watch the demo. Install this plugin. Use this CSS. Enjoy.
Reply
#18
(2013-05-25, 06:31:47)mvlcek Wrote:
(2013-05-25, 06:18:58)lnickel Wrote: So I take this code and make a component from it and call it it as a param in the get_nav function. Cool. Just dont know how to do the if/else

PHP code between <?php and ?>, HTML outside:
Code:
<li class="<?php echo $item->classes; ?>">
  <?php if ($item->hasChildren) { ?>
     <a href="<?php echo htmlspecialchars($item->link); ?>">
       <?php echo htmlspecialchars($item->text); ?>
     </a>
  <?php } else { ?>
     <?php echo htmlspecialchars($item->text); ?>
  <?php } ?>

  <?php if ($item->isOpen) { ?>
    <ul><?php $item->outputChildren(); ?></ul>
  <?php } ?>
</li>

You could of course also write the else-part simply as
Code:
  <?php } else { echo htmlspecialchars($item->text); } ?>

Hi mvlcek,
I am using i18n for php8 but the component paramter doesn't work, is possible to fix it? I need to put there a custom rendering. Thanks
Reply
#19
SOLVED:
replace I18nNavigationItem with __construct
in line:361 in plugins/i18n_navigation/frontend.class.php
Reply




Users browsing this thread: 1 Guest(s)