CSS Current page
21 posts by 7 authors in: Forums > CMS Builder
Last Post: March 18, 2009 (RSS)
By Djulia - March 11, 2009
I found the origin of my problem.
The condition was not correctly positioned. [crazy]
<?php foreach ($secondaryRecords as $record): ?><a href="<?php echo $record['_link'] ?>"><?php if ($num == $record['num']): ?>1<?php endif; ?></a> - <?php print_r($record['num']); ?><br /><?php endforeach; ?>
Djulia
By Dave - March 11, 2009
interactivetools.com
Re: [Dave] CSS Current page
By Perchpole - March 11, 2009
It's delightfully simple.
:0)
Perchpole
Re: [Perchpole] CSS Current page
By Djulia - March 12, 2009 - edited: March 12, 2009
In fact, I wanted to remove the link for the active page.
What complicates a little the use :
<?php foreach ($secondaryRecords as $record): ?>
<?php if ($num == $record['num']): ?>
Page (ID 1)
<?php else: ?>
<a href="...">Page (ID 2)</a>
<a href="...">Page (ID 3)</a>
...
<?php endif; ?>
<?php endforeach; ?>
The problem now, it is with the use of several sections on the same page.
If there is a recording of another section with the same value (ID) the condition is also applied.
MY MENU
Section 1
<?php foreach ($seconeRecords as $record): ?>
<?php if ($num == $record['num']): ?>
Page (ID 1)
<?php else: ?>
<a href="...">Page (ID 2)</a>
<a href="...">Page (ID 3)</a>
...
<?php endif; ?>
<?php endforeach; ?>
Section 2
<?php foreach ($sectwoRecords as $record): ?>
<?php if ($num == $record['num']): ?>
Page (ID 1)
<?php else: ?>
<a href="...">Page (ID 2)</a>
<a href="...">Page (ID 3)</a>
...
<?php endif; ?>
<?php endforeach; ?>
I think that it is necessary to add a condition (perhaps on _filename (?) ).
Djulia
Re: [Dave] CSS Current page
By Djulia - March 12, 2009
You think that there is a solution with the problem mentioned above ?
I forgot to add that this condition is used in a include (includes/nav.php) to optimize the use.
Thanks for your assistance.
Djulia
By Dave - March 12, 2009
I'm not sure I follow. Can you provide a sample url that shows the page you're working on?
Thanks!
interactivetools.com
Re: [Dave] CSS Current page
By Djulia - March 14, 2009 - edited: March 14, 2009
In fact, we adapted the code on each page. That thus avoids applying the condition to the same recording (or $num) of section 1 and 2 on the page.
Here an example :
On page newsDetail_1.php.
For the section 1 (tableName1) :
<?php foreach ($listingRecords as $record):
if ($num == $record['num']) { continue; } ?>
<li><a href="<?php echo $record['_link'] ?>"><?php echo $record['title'] ?></a></li>
<?php endforeach; ?>
For the section 2 (tableName2) :
<?php foreach ($listingtwoRecords as $record): ?>
<li><a href="<?php echo $record['_link'] ?>"><?php echo $record['title'] ?></a></li>
<?php endforeach; ?>
...and on page newsDetail_2.php
For the section 1 (tableName1) :
<?php foreach ($listingRecords as $record):
<li><a href="<?php echo $record['_link'] ?>"><?php echo $record['title'] ?></a></li>
<?php endforeach; ?>
For the section 2 (tableName2) :
<?php foreach ($listingtwoRecords as $record): ?>
if ($num == $record['num']) { continue; } ?>
<li><a href="<?php echo $record['_link'] ?>"><?php echo $record['title'] ?></a></li>
<?php endforeach; ?>
Djulia
By ross - March 16, 2009
Thanks for the follow up. I am still having some trouble following along though. Could you post a link to your site so we can take a closer look at what's happening?
Thanks!
Cheers,
Ross Fairbairn - Consulting
consulting@interactivetools.com
Hire me! Save time by getting our experts to help with your project.
Template changes, advanced features, full integration, whatever you
need. Whether you need one hour or fifty, get it done fast with
Priority Consulting: http://www.interactivetools.com/consulting/
Re: [ross] CSS Current page
By Djulia - March 16, 2009
[font "Verdana"]I communicate it to you in private message.
Thanks for your comprehension.
[font "Verdana"]Djulia
By ross - March 17, 2009
I'll be in touch as soon as I can. I'll have to read through your code to get a better idea of what's going on.
Thanks for getting me the details though :). That makes this a lot easier to troubleshoot.
Cheers,
Ross Fairbairn - Consulting
consulting@interactivetools.com
Hire me! Save time by getting our experts to help with your project.
Template changes, advanced features, full integration, whatever you
need. Whether you need one hour or fifty, get it done fast with
Priority Consulting: http://www.interactivetools.com/consulting/