3 of 7
3
Navigator module (navigation builder)
Posted: 06 August 2006 04:07 PM   [ Ignore ]   [ # 37 ]  
Research Assistant
RankRankRank
Total Posts:  324
Joined  06-13-2005

Thanks for the reply.

Yes, I tried that. But in this case I MUST add the ‘category’ word (Category URL Indicator) in the next field. I don’t like to see this “additional” word in URL.

If you set the above preference to “yes” you must choose a reserved word. This word will be used in the URL to indicate to the weblog display engine that you are showing a category.

 Signature 

tulks.com | sparkframe.com (Powered by SparkFrame v.2)

Profile
 
 
Posted: 06 August 2006 05:18 PM   [ Ignore ]   [ # 38 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  500
Joined  02-05-2002

Use another plugin to replace it?

Profile
 
 
Posted: 07 August 2006 12:36 AM   [ Ignore ]   [ # 39 ]  
Research Assistant
RankRankRank
Total Posts:  324
Joined  06-13-2005

Now I use your module, but with the full path as “Custom URL (Template, Category and Entry Title will be ignored)”.

P.S. And now I see maybe this FR is not important because I see I won’t use Categories at all. I use Segment 4. That means if I use Categories, I should enter them twice: as a Segment in the Navigator and as a Category in the Categories. This way is not logical. I should enter them one time, that means they won’t be shown in the Category field in the Navigator.

So, the only way is to use Custom URL (I do that now).

EDITED:

No, Categories should be used also. Because ‘exp:weblog:entries’ uses them (category=).

So, I should enter the same data twice. As Categories only to select Entries in ‘exp:weblog:entries’ :(

I hope I’ll have a better idea (how to use ‘exp:weblog:entries’ without Categories to enter Segment 4 only once, in Navigator only).

 Signature 

tulks.com | sparkframe.com (Powered by SparkFrame v.2)

Profile
 
 
Posted: 08 August 2006 02:38 AM   [ Ignore ]   [ # 40 ]  
Research Assistant
RankRankRank
Total Posts:  324
Joined  06-13-2005

Dear Cocoaholic,

I’ve completed a personal project (a links catalog) with your Navigator module.

But there’s a small programming problem.

The module shows all Item Titles. But this menu can be used in several languages/templates, e.g.,

{exp:navigator group="<?php echo $nv_grp; ?>"}

<a href="http://***/lv/weblinks/{segment_3}/{nav_title}/">{exp:localized_text string="{nav_title}" file="my_localized_text" language="latvian"}</a></div>

{/exp:navigator} 

and that would be desirable not show some Items in some languages, e.g., not to show some specific info that is not actual for foreign visitors.

For example, to write in Edit Item somewhere in a field (e.g., Description) that this Item should not be shown in exp:navigator for some parameters.

Maybe there’s an idea how to do that?

Thanks.

 Signature 

tulks.com | sparkframe.com (Powered by SparkFrame v.2)

Profile
 
 
Posted: 08 August 2006 04:03 AM   [ Ignore ]   [ # 41 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  500
Joined  02-05-2002

You can use conditionals.

In this example I used the Description field to specify if an item is for a specific language only, if the item should be shown to all countries I left the Description field blank so it will show the default language, in my case ‘english’.
This might not exactly be what you had in mind, but I’m pretty sure you can use EE’s conditionals to do the job.

{exp:navigator group="<?php echo $nv_grp; ?>"}

{if nav_description 
== ""}

<a href="http://***/en/weblinks/{segment_3}/{nav_title}/">{nav_title}</a></div>

{if:elseif nav_description == "fr" AND segment_1 == "fr"}

<a href="http://***/fr/weblinks/{segment_3}/{nav_title}/">{exp:localized_text string="{nav_title}" file="my_localized_text" language="french"}</a></div>

{if:elseif nav_description == "lv" AND segment_1 == "lv"}

<a href="http://***/lv/weblinks/{segment_3}/{nav_title}/">{exp:localized_text string="{nav_title}" file="my_localized_text" language="latvian"}</a></div>

{/if}

{
/exp:navigator} 
Profile
 
 
Posted: 08 August 2006 04:09 PM   [ Ignore ]   [ # 42 ]  
Research Assistant
RankRankRank
Total Posts:  324
Joined  06-13-2005

I tried to use a plugin to compare {nav_description} and {segment_1}.

For example, {nav_description} has en|de,
and if {segment_1} is fr

{exp:compare long="{nav_description}" short="{segment_1}"

http://expressionengine.com/forums/viewthread/37029/

gives ‘0’.

But this code

{if {exp:compare long="{nav_description}" short="{segment_1}"== "0"

doesn’t work.

It works only in this combination:

{exp:compare long="{nav_description}" short="{segment_1}"}
{if {exp
:compare long="{nav_description}" short="{segment_1}"== "0"

Now I see the only way is to edit the Module not to show some Menu Items for some parameters.

 Signature 

tulks.com | sparkframe.com (Powered by SparkFrame v.2)

Profile
 
 
Posted: 08 August 2006 04:11 PM   [ Ignore ]   [ # 43 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  500
Joined  02-05-2002

Feel free to edit the Module smile

Profile
 
 
Posted: 08 August 2006 05:13 PM   [ Ignore ]   [ # 44 ]  
Chancellor's Fellow
Avatar
RankRankRankRankRankRankRankRank
Total Posts:  30388
Joined  04-29-2002

Cocoaholic, any chance to add a clone a group? I’m building 5 or 6 menus at a time, and the only thing that’s different is one class per menu.

Profile
MSG
 
 
Posted: 08 August 2006 05:19 PM   [ Ignore ]   [ # 45 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  500
Joined  02-05-2002

Sue,

Thanks for the feedback.

Cloning groups would be nice, might look into that.

Wouldn’t it be wiser (and easier to maintain) to use another way to change the class?
Conditionals perhaps?

Can you explain your setup / what you are trying to do / show us some code?

Cheers

Profile
 
 
Posted: 08 August 2006 06:01 PM   [ Ignore ]   [ # 46 ]  
Chancellor's Fellow
Avatar
RankRankRankRankRankRankRankRank
Total Posts:  30388
Joined  04-29-2002

It probably would be easier to use something like Jesse’s technique to set a class: Dynamic CSS Navigation and use the Navigation Builder to just use the class=“whatever-segment-three-is” instead.

Then set the style based on {segment_3}

Profile
MSG
 
 
Posted: 14 August 2006 08:42 PM   [ Ignore ]   [ # 47 ]  
Summer Student
Avatar
Total Posts:  8
Joined  05-12-2006

First off, great module.  It has been a tremendous help in managing all the menus for the site I’m building.  I’m even using it to build the sitemap (I have a “sitemap” navigator group that holds the group names of the menus to compile the sitemap with).

But I find having to use the ID to pull the navigator menu you want to be confusing at best when you’ve got more than a few menus (16 and counting here), and it also makes it difficult to tie the url to the menus.  So I made a simple change to the module that allows you to use the group short name instead if you want to.

I thought I’d post it here incase anyone else might be interested in achieving the same.  It’s really quite simple.  Just open mod.navigator.php and find on lines 73-79:

// -------------------------------------------------------
        //    Fetch all data from Navigator Group
        // -------------------------------------------------------
        
        
$query $DB->query("SELECT * FROM exp_navigator_data
                             WHERE group_id = 
$group_id
                             ORDER BY 
$orderby $sort"); 

And replace with:

// -------------------------------------------------------
        //    Fetch all data from Navigator Group
        // -------------------------------------------------------

        
if (is_numeric($group_id)) {
            $group_id 
= (int)$group_id;
            
$query $DB->query("SELECT * FROM exp_navigator_data
                                 WHERE group_id = 
$group_id
                                 ORDER BY 
$orderby $sort");
        
else {
            $group_title 
$DB->escape_str($group_id);
            
$query $DB->query("SELECT nd.* FROM 
                                    exp_navigator_data nd, 
                                    exp_navigator_groups ng 
                                 WHERE ng.group_title = '
$group_title' AND 
                                    ng.group_id = nd.group_id 
                                 ORDER BY 
$orderby $sort");
        

That’s it.  It will still accept the ID if you pass a numeric value, or will use the group short name/title if not, i.e:

<!-- Both are accepted now -->

{exp:navigator group="12"}
    
<!-- ... -->
{/exp:navigator}


{exp
:navigator group="group_name"}
    
<!-- ... -->
{/exp:navigator} 

It’s been a life saver for me wink


I also added a “count” coditional param because there are sometimes I want to do something every so many itterations.  This was also very easy to add.  For anyone interested, again in the mod.navigator.php file, go down to roughly link 225 and find:

// -------------------------------------------------------
            //    Prep Conditionals
            // -------------------------------------------------------
            
            //$cond['sub_items'] = ($subitems[$i] != 'parent') ? 'FALSE' : 'TRUE';
            //$cond['last_sub_item'] = ($subitems[$i] != 'last_sub_item') ? 'FALSE' : 'TRUE';
            
            
$cond['nav_title'= ($row['nav_title'== '0') ? 'FALSE' $row['nav_title']

And replace with:

// -------------------------------------------------------
            //    Prep Conditionals
            // -------------------------------------------------------

            //$cond['sub_items'] = ($subitems[$i] != 'parent') ? 'FALSE' : 'TRUE';
            //$cond['last_sub_item'] = ($subitems[$i] != 'last_sub_item') ? 'FALSE' : 'TRUE';

            
$cond['count'$i;

            
$cond['nav_title'= ($row['nav_title'== '0') ? 'FALSE' $row['nav_title']

That’s all again.  Now you can use a count conditional, i.e:

{exp:navigator group="group_name"}
    {if 
(count == "6") || (count == "11") || (count == "16") || (count == "21")}
        
<!-- ... -->
    
{if:else}
        
<!-- ... -->
    
{/if}
{
/exp:navigator} 

Anyways, just wanted to share that, and thanks again for the great module smile

Profile
 
 
Posted: 15 August 2006 04:14 AM   [ Ignore ]   [ # 48 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  500
Joined  02-05-2002

Hi dreamscape,

Thanks for sharing your additions to the module!
If you don’t mind I’ll add these to the next version smile

btw, I’d love to see how you built that sitemap.

Cheers

Profile
 
 
Posted: 15 August 2006 04:32 AM   [ Ignore ]   [ # 49 ]  
Summer Student
Avatar
Total Posts:  8
Joined  05-12-2006
Cocoaholic - 15 August 2006 08:14 AM

btw, I’d love to see how you built that sitemap.

Sure, here is how I’m doing it.
- I have a navigator group that I call “Site Map” that just holds references to the navigator groups I want in my sitemap.  (This is for a human site map, but the same principles could be used to build an XML sitemap for Google)
- The reference for each group in the sitemap is kept in the Properties field.  The entries only have this filled in with the navigator group they represent + the title.
- Then, I just nest navigator tags in the template to build the sitemap. I found you cannot directly nest them; however, you can use embed to nest them.

Here is some basic template code for 2 templates, site/sitemap (the main sitemap), and site/sitemap-sub (each group in the sitemap):

site/sitemap:

<h1>Site Map</h1>
<
ul>
{exp:navigator group="sitemap"}
    
<li><h2>{nav_title}</h2>
        
{embed="site/sitemap-sub" group="{nav_properties}"}
    
</li>
{/exp:navigator}
</ul

site/sitemap-sub:

<ul>
{exp:navigator group="{embed:group}"}
    
<li><h3><a href="{nav_url}">{nav_title}</a></h3></li>
{/exp:navigator}
</ul

It is working quite well for me, and saves me from having to manually make the sitemap or duplicate existing navigator groups wink

In addition to a sitemap, it would also work well if you wanted to show numerous navigator groups together on certain pages/sections and there was some crossover. Instead of making groups that crossover or manually coding the right groups for each section into the template, one could make a single group for each section that just controls which navigator groups are to appear and in what order.  I haven’t used this little trick to do this yet, but I have a feeling I will for a couple sections of the site I am building.

Profile
 
 
Posted: 15 August 2006 04:42 AM   [ Ignore ]   [ # 50 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  500
Joined  02-05-2002

Smart solution.

I knew nesting navigator groups doesn’t work so I was curious how you did it.
Good to know “embed” will do the trick.

I thought you might have used some AJAX workaround, which is what I do to get dynamic data into EE’s static templates like the “User Message Template”.

Thanks.

Profile
 
 
Posted: 25 August 2006 03:57 PM   [ Ignore ]   [ # 51 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  169
Joined  03-17-2006

dreamscape, any chance we could see those two solutions in action by posting a link to the site when it’s ready? smile

Profile
 
 
Posted: 06 October 2006 06:26 PM   [ Ignore ]   [ # 52 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1757
Joined  03-26-2006

I installed this plugin and definitely wanted to refer to my groups using names rather than IDs as well, so I made the modification to the query that dreamscape suggested - but it didn’t work because I don’t have a group_title field in my exp_navigator_groups table. There are only two columns - group_id and group_name. Don’t know why I’m missing that field, but I just changed the query to refer to the group_name instead:

else {
  $group_title 
$DB->escape_str($group_id);
  
$query $DB->query("SELECT nd.* FROM
  exp_navigator_data nd,
  exp_navigator_groups ng
  WHERE ng.group_name = '
$group_title' AND ng.group_id = nd.group_id
  ORDER BY 
$orderby $sort");

I Just changed the WHERE clause to reference group_name and can now refer to navigation groups like this:

{exp:navigator group="Footer Nav"

Being a web designer, those capitals and the space bug me - I’d much rather it read

{exp:navigator group="footer-nav"

but it appears to work for me right now. Any idea why I don’t have that group_title column in my table?  Do I have an older version of this module (using Navigator Build: 20060413 aka v1.0)? Did I miss something in this thread? Time to reread…

 Signature 

ryan masuga
—————
Masuga Design | devot:ee
@masuga | @masugadesign | @devot_ee

Profile
 
 
Posted: 06 October 2006 07:37 PM   [ Ignore ]   [ # 53 ]  
Summer Student
Avatar
Total Posts:  8
Joined  05-12-2006
mdesign - 06 October 2006 10:26 PM

Did I miss something in this thread?

Oops, I missed something.  It appears I modified my navigator module to put in a group short name (ie the group_title) field.  I’ve made a number of mods to it, and just forgot that one was a mod and not in there by default.

Profile
 
 
Posted: 07 October 2006 03:59 AM   [ Ignore ]   [ # 54 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  500
Joined  02-05-2002

Hi all,

I will implement the changes made by dreamscape after the weekend.

Cheers

Profile
 
 
   
3 of 7
3
 
‹‹ Webring module?      FreeForm 2.0 ››