Forums / General Questions / Linking to an EZ Page or Separating EZ Pages into Drop Downs

Linking to an EZ Page or Separating EZ Pages into Drop Downs

Started by ae12 on 5 Nov 2012, 9:36 AM · Views: 712

Results 1 to 6 of 6
5 Nov 2012, 9:36 AM
#1
ae12 avatar

ae12

New Zenner

Join Date:
Oct 2012
Posts:
10
Plugin Contributions:
0

Linking to an EZ Page or Separating EZ Pages into Drop Downs

Hi,

I am very new to this and I suspect that this will be very simple but I don't have enough knowledge to work it out. I have googled and searched the forums but cannot find specifically what I am after.

I haven't got a link because it is on a local host, so I apologise for the inconvenience.

I have my EZ Pages listed in a menu:

Trends :: Wishlists :: Gift Certificates :: About Us

I would like to add an extra EZ Page in a drop-down menu under About Us called "Why buy from us".

It would be good if this list was then editable in the admin to add more links etc.

  1. I have searched the forums for a way of seperating the EZ Page links in order to style some of them in a drop-down but cannot find the answer

  2. I then tried putting them in a <ul> and hard coded it like this:

<div id="navEZPagesTop"> <ul> <?php for ($i=1, $n=sizeof($var_linksList); $i<=$n; $i++) { ?> <li><a href="<?php echo $var_linksList[$i]['link']; ?>"><?php echo $var_linksList[$i]['name']; ?></a></li><?php echo ($i < $n ? EZPAGES_SEPARATOR_HEADER : '') . "\n"; ?> <?php } // end FOR loop ?> <li class="extraUL"><a href="<?php echo zen_ez_pages_link(12) ;?>">About Us</a> <ul> <li><a href="<?php echo zen_ez_pages_link(15) ;?>">Why Buy From Us</a></li> </ul>
</li>
</ul> </div>

This would work fine, except that the site is bilingual and I need the name of the link to pull in the information from the name of the EZ Page

I really hope this makes sense!

Thank you

I have attached screen shots

5 Nov 2012, 3:42 PM
#2
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,874
Plugin Contributions:
8

Re: Linking to an EZ Page or Separating EZ Pages into Drop Downs

Have you looked at EZ-Pages Improved Menus in Plugins? It builds the <ul> list dynamically and is multi-lingual. There is a post in its support thread (or possibly in the EZ-Pages Footer Columns thread) to help coordinate it with the Multi-Language EZ-Pages mod.

It does not make multi-level lists, though; you would have to put the "why buy" page in a chapter with About Us and show it in the TOC. There might be a CSS solution... I would have to look at it more.

6 Nov 2012, 11:09 AM
#3
ae12 avatar

ae12

New Zenner

Join Date:
Oct 2012
Posts:
10
Plugin Contributions:
0

Re: Linking to an EZ Page or Separating EZ Pages into Drop Downs

Hi, thank you for your help, it is much appreciated.

I did have a look at EZ-pages Improved menus, I actually added it but it stopped the ez-page content displaying. I realised that it was for 1.3.9 and I am using 1.3.8a which is what I assume is causing it. I cannot upgrade because these are supposed to be small amendments to a clients site and upgrading would have to be costed.

Is there no way of linking to an individual EZ Page where the title is pulled through? Even if it is effectively hard coded.

Like, is there not a way of putting some php in between the <a> and </a> that tells it to get the title of the ez page id?

Thanks again, I'm sorry if this comes across as a stupid question but this is only the second time I have ever been near zen cart, php and any other form of templates etc I only know basic HTML/CSS.

6 Nov 2012, 3:42 PM
#4
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,874
Plugin Contributions:
8

Re: Linking to an EZ Page or Separating EZ Pages into Drop Downs

The reason EZ-Pages Improved Menus would have crashed is that the multi-language mod changes a file it also changes, so it no longer gets information. It is an easy fix to add the needed information lookup to the multi-language file.
Discussion of the issue and fix here for the footer bar:
http://www.zen-cart.com/showthread.php?191353-Help-Footer-Text-link-doesn-t-appear

The fix for the "menus" mod would be similar but not identical. I need to get that sorted for the new version of the mod anyway, so I will be taking care of it soon. Then there should be no issue using the two together. I don't know of a way to call a particular language version of an ez-page using the standard functions or links - they are built for one language only.

7 Nov 2012, 11:31 AM
#5
ae12 avatar

ae12

New Zenner

Join Date:
Oct 2012
Posts:
10
Plugin Contributions:
0

Re: Linking to an EZ Page or Separating EZ Pages into Drop Downs

Thank you for your help. I will do that today but I have acually resolved my problem (although probably not technically "right")

I ended up hard coding the link where I put:

<li><a href="<?php echo zen_ez_pages_link(12) ;?>"><?php echo ABOUT_US_HEADER; ?></a></li>       

where (12) is the id of the ez page

And then in
includes/languages/english/extra_definitions/my_template and
includes/languages/cymraeg/extra_definitions/my_template

I created files called category_menu_defines.php

and I put this in them:

<?php Define('WHY_BUY', 'Why Buy from Us'); Define('ABOUT_US_HEADER', 'About Us'); ?>

Where one file had 'Why Buy from Us' and the other had it in Welsh.

Like I said I have absolutly NO php knowledge so I have probably broken many rules and done it wrong but it has worked (for now at least)!!

Thanks Again

7 Nov 2012, 4:30 PM
#6
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,874
Plugin Contributions:
8

Re: Linking to an EZ Page or Separating EZ Pages into Drop Downs

Actually that is a very good way to do it.
Obviously a general-purpose functionality would need to make the display automatic for any ez-page without a custom define file, but what you have done is a proper way to use the built-in override and language system.