Welcome Guest, Not a member yet? Register   Sign In
Dynamically Generated Navigation
#1

[eluser]dobbler[/eluser]
Hi,

I'm in a bit of a pickle in that I've committed to a large project and am a complete newbie with CI. Hopefully someone can help with the logic behind outputting a dynamic navigation.

I'm trying to emulate this type of nav and I have three tables in my db like so:

PrimaryNav
PrimaryNavId (INT) PK
PrimaryNavText (VARCHAR 100)
PrimaryNavTitle (VARCHAR 100)

SecondaryNav
SecondaryNavId (INT) PK
PrimaryNavId (INT)
SecondaryNavTitle (VARCHAR 100)
SecondaryNavText (VARCHAR 100)
SecondaryNavBody (VARCHAR 100)
UserId (INT)
DatePosted (DATETIME)

TertiaryNav
TertiaryNavId (INT) PK
SecondaryNavId (INT)
TertiaryNavTitle (VARCHAR 100)
TertiaryNavText (VARCHAR 100)
TertiaryNavBody (VARCHAR 100)
UserId (INT)
DatePosted (DATETIME)

The HTML output from CSSPlay.co.uk is:

Quote:<ul id="nav">
<li><a href="#nogo">Home</a></li>

<li><a href="#nogo">About »&lt;!--[if gte IE 7]>&lt;!--&gt;</a>&lt;!--<![endif]--&gt;
&lt;!--[if lte IE 6]><table><tr><td><![endif]--&gt;<ul>
<li><a href="#nogo">Who we are</a></li>
<li><a href="#nogo">What we do</a></li>
<li><a href="#nogo">Where to find us</a></li>
</ul>&lt;!--[if lte IE 6]></td></tr></table></a><![endif]--&gt;
</li>
<li><a href="#nogo">Products »&lt;!--[if gte IE 7]>&lt;!--&gt;</a>&lt;!--<![endif]--&gt;

&lt;!--[if lte IE 6]><table><tr><td><![endif]--&gt;<ul>
<li><a href="#nogo">Tripods »&lt;!--[if gte IE 7]>&lt;!--&gt;</a>&lt;!--<![endif]--&gt;
&lt;!--[if lte IE 6]><table><tr><td><![endif]--&gt;<ul>
<li><a href="#nogo">Monopods</a></li>
<li><a href="#nogo">Tripods</a></li>
<li><a href="#nogo">Adjutable head</a></li>
<li><a href="#nogo">Fixed</a></li>
</ul>&lt;!--[if lte IE 6]></td></tr></table></a><![endif]--&gt;
</li>
<li><a href="#nogo">Films »&lt;!--[if gte IE 7]>&lt;!--&gt;</a>&lt;!--<![endif]--&gt;
&lt;!--[if lte IE 6]><table><tr><td><![endif]--&gt;<ul>
<li><a href="#nogo">35mm</a></li>

<li><a href="#nogo">Color Print</a></li>
<li><a href="#nogo">Black and White</a></li>
<li><a href="#nogo">Roll</a></li>
<li><a href="#nogo">Color Slide</a></li>
</ul>&lt;!--[if lte IE 6]></td></tr></table></a><![endif]--&gt;
</li>
<li><a href="#nogo">Cameras »&lt;!--[if gte IE 7]>&lt;!--&gt;</a>&lt;!--<![endif]--&gt;

&lt;!--[if lte IE 6]><table><tr><td><![endif]--&gt;<ul>
<li><a href="#nogo">Compact »&lt;!--[if gte IE 7]>&lt;!--&gt;</a>&lt;!--<![endif]--&gt;</li>
<li><a href="#nogo">Digital »&lt;!--[if gte IE 7]>&lt;!--&gt;</a>&lt;!--<![endif]--&gt;</li>
<li><a href="#nogo">SLR »&lt;!--[if gte IE 7]>&lt;!--&gt;</a>&lt;!--<![endif]--&gt;</li>
</ul>&lt;!--[if lte IE 6]></td></tr></table></a><![endif]--&gt;
</li>

<li><a href="#nogo">Flash</a></li>
<li><a href="#nogo">Video</a></li>
</ul>&lt;!--[if lte IE 6]></td></tr></table></a><![endif]--&gt;
</li>
<li><a href="#nogo">FAQs »&lt;!--[if gte IE 7]>&lt;!--&gt;</a>&lt;!--<![endif]--&gt;
&lt;!--[if lte IE 6]><table><tr><td><![endif]--&gt;<ul>
<li><a href="#nogo">Cameras</a></li>

<li><a href="#nogo">Film types</a></li>
<li><a href="#nogo">Digital Photography</a></li>
</ul>&lt;!--[if lte IE 6]></td></tr></table></a><![endif]--&gt;
</li>
<li><a href="#nogo">Privacy »&lt;!--[if gte IE 7]>&lt;!--&gt;</a>&lt;!--<![endif]--&gt;
&lt;!--[if lte IE 6]><table><tr><td><![endif]--&gt;<ul>
<li><a href="#nogo">Privacy Policy</a></li>
<li><a href="#nogo">Privacy Statement</a></li>

</ul>&lt;!--[if lte IE 6]></td></tr></table></a><![endif]--&gt;
</li>
<li><a href="#nogo">Contact us</a></li>
</ul>

And obviously there's a css file that goes with it..

My brain is just not getting around it.. Any help on this would be greatly appreciated.

I'm somewhat freaking out!

Thanks in advance.

Rob.
#2

[eluser]Colin Williams[/eluser]
Ha! That code is whack! I don't think, even in the dark ages, I ever saw a <table> element inside an <a> element. Anyway, you got that from a run-of-the-mill CSS site and didn't craft it yourself, so I guess I can't hold YOU accountable for that...

About your situation, I'm not sure you can learn this craft in enough time to satisfy your client. You're stab at setting up that database shows a severe lack of discipline in this arena, particularly in database design and normalization.

Looks like you need a CMS, like Drupal or ExpressionEngine. Don't build your own at this point. And don't offer to mow someone's lawn if you don't know how to operate a lawn mower. I'm just sayin'...




Theme © iAndrew 2016 - Forum software by © MyBB