Regex removal

13 posts by 2 authors in: Forums > CMS Builder
Last Post: May 14, 2010   (RSS)

Re: [dsternalski] Regex removal

By Jason - May 10, 2010

Hi,

So you are trying to control what is displayed in navigation.php?

Can you tell me exactly which articles that are not meant to be in the navigation are showing up? Do you want to just hide these articles, or do you want to not have them outputted at all?

Let me know and I'll see what I can do.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] Regex removal

By dsternalski - May 10, 2010

Hi,

Yes I am trying to control what is being displayed in the navigation.

All <li> that aren't meant to be in the navigation at the moment are using a class of "noNav" in the <a> tag as these are features on the page but don't require any navigation to display either on the front end or in the source code, but at the moment they are displaying in the source code.

Also in the code there are empty <li></li> which need to not display in the source code (I just took out the link completely from the code rather than add the "noNav" class).

Re: [dsternalski] Regex removal

By Jason - May 10, 2010

Hi,

So, links that have the "noNav" class, you still want them to display?

As for the empty <li></li>, where exactly in the code are those being produced? For a normal <li>, what fields would be outputted there?

It is possible that they are outputted when you have records with empty fields. You could always check the field before you output it, like this:

<?php if($categoryRecord['name']): ?>
*OUTPUT <li></li>*
<?php endif?>


Let me know if this sounds like we're on the right track.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] Regex removal

By dsternalski - May 10, 2010

Hi,

The links with "noNav" don't need to be displayed.

The <li></li> are being used for the Navigation Name field for the navigation. However, these fields are also being used when the features are being created (so the user knows what article holds a feature).

As for the empty <li></li> tags, these are the same as the "noNav" only I removed the <a> tag from the code, so neither of these need to display.

All Category name fields are being used.

Please note that "noNav" and the empty <li></li> tags are navigation that isn't needed as these are the features for the page.

Please find attached 3 screen shots. The elements in the red box is one of the features that either displays in the source with "noNav" or displays as empty an <li></li>.

I hope this makes sense.
Attachments:

frontend.jpg 741K

backendlist.jpg 288K

articleinfo.jpg 357K

Re: [dsternalski] Regex removal

By Jason - May 11, 2010

Hi,

From what I can see, you're outputting an <a> tags when "featureSelect" has been selected. An easy way to get rid of these tags, is to only output the <a> tags you want when "featureSelect" has not been selected.

For example, in your code you are currently displaying a link like this:

<?php if (strlen($categoryRecord['featureSelect'])) { ?>
<a class="noNav" href="<?php echo $categoryRecord['_link'] ?>"><?php echo $categoryRecord['name'] ?></a>
<?php } else { ?>
<a <?php ?> href="<?php echo $categoryRecord['_link'] ?>"><?php echo $categoryRecord['name'] ?></a>
<?php } ?>


You can replace this with this code:

<?php if(!$categoryRecord['featureSelect']) : ?>
<a <?php ?> href="<?php echo $categoryRecord['_link'] ?>"><?php echo $categoryRecord['name'] ?></a>
<?php endif ?>


Let's start there. Give that a try and let me know if that works out.

Hope this helps.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] Regex removal

By dsternalski - May 11, 2010

Hi,

this worked! thank you!!!

Re: [dsternalski] Regex removal

By Jason - May 11, 2010

Awesome! Glad to hear that's working for you now.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] Regex removal

By dsternalski - May 12, 2010

Hi,

this worked on the main navigation section of my code, but the empty <li></li> are still displaying on my other section of navigation (even though they're using the same code?).

Re: [dsternalski] Regex removal

By Jason - May 14, 2010

Hi,

Which file is the other navigation coming from? Is it curriculum.php?

Let me know and attach the most up to date copies of the files.

Thanks.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/