We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Problem with site design

How Do I?

Claus's avatar
Claus
35 posts
one month ago
Claus's avatar Claus

I’m having a problem with the site I’m about to design. My site has 12 menu entries. Would I then also need 12 channels and 12 entries? And: I have only five templates: _header, _main, _footer, 404, and index. Would I need something like an if query to decide what content to display depending on what menu item I click?

P. S.: My home/index template looks like this:

{embed="home/_header"}
{embed="home/_main"}
{embed="home/_footer"}

.

I got a code snippet with an if query (see attachment), but this isn’t working properly, that is, the CSS class ‘nav’ is not being recognized.

       
JCOGS Design's avatar
JCOGS Design
135 posts
one month ago
JCOGS Design's avatar JCOGS Design

Hi Claus

There are two questions here - why is your snippet not working, and what do you need to make menus in EE.

Snippet

The syntax of your {if} statement is not correct and so probably EE is getting confused. You should try something like …

<li><a href="http://{path=%27%27}" class="nav{if class == nav && segment_1 == home} active{/if}">Home</a></li>

I’m guessing from your original snippet that there is some kind of variable called class. Depending on how this value is generated you may need to tweak the if statement to get it to be recognised.

In passing,

  • these days there are not many situations where using unsecured http connections is a good idea - so might be worth looking at your setup to see if you can use https.

  • you might be able to use {site_url} in place of your http://{path=''} construct.

Menus

You can construct menus in a variety of ways in EE, and you certainly don’t need one channel per menu item. Which approach you use depends somewhat upon whether you want to have the ability to control / amend the menu design from within the EE control panel or not.

If you are not planning to modify the menu system from within CP you could simply hard-code the menu design into a template.

If you plan to allow the menu system to be edited from within the CP, you need to decide upon a mechanism for identifying what each menu item should be, and how they are related (e.g. if you plan to do ‘nested’ menus etc).

There are a variety of ways of doing this within EE core features such as using a dedicated channel for the menu items, using EE’s categories system, or using EE’s relationship system.

Alternatively you can use a third-party add-on to build the menu - if you are not so familiar with EE this might be a good option. One example is “Super Navigation” but there are others.

HTH 🐾

       
Claus's avatar
Claus
35 posts
one month ago
Claus's avatar Claus

Hi,

and many thanks for your suggestions.

> You should try something like …

This worked. Now my menu looks right after all.

> where using unsecured http connections is a good idea …

I have EE installed on a local XAMPP environment with no connection to the internet. When the site is online, there will be https:// of course.

> If you are not planning to modify the menu system from within CP you could simply hard-code the menu design into a template.

CP = control panel, right? The menu is so far a partial. Is this ok?

Claus

👍 1
       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.