Page 1 of 1
What is the Smarty code to strip out <h3></h3>
Posted: Thu Oct 08, 2009 10:50 pm
by replytomk3
I am trying to strip out from the code that is generated from
{menu start_level="1" number_of_levels="1"}
can someone give me the Smarty code for this?
Re: What is the Smarty code to strip out <h3></h3>
Posted: Sun Oct 11, 2009 5:40 pm
by mcDavid
Re: What is the Smarty code to strip out <h3></h3>
Posted: Sun Oct 11, 2009 9:16 pm
by replytomk3
Yes, I did see that manual. And while thanks for the exact name of the command, how do I do this without creating a smarty variable articleTitle?
Why didn't something like this work:
{menu start_level="1" number_of_levels="1" | regex}
Re: What is the Smarty code to strip out <h3></h3>
Posted: Mon Oct 12, 2009 8:13 pm
by JeremyBASS
if you want to do this... you could go
{capture assign=levelOneMenu}{menu start_level="1" number_of_levels="1"}{/capture}
{$levelOneMenu|replace:"":""|replace:"":""}
that should do what your asking.. If I understand what your wanting...
Cheers
Jeremy
Re: What is the Smarty code to strip out <h3></h3>
Posted: Tue Oct 13, 2009 2:37 am
by replytomk3
naive question: can I do this without any assignments to variables?
Note to self: stay away from Smarty.
Re: What is the Smarty code to strip out <h3></h3>
Posted: Tue Oct 13, 2009 4:31 am
by JeremyBASS
replytomk3 wrote:
naive question: can I do this without any assignments to variables?
Note to self: stay away from Smarty.
Here are some thing that helped me get Smarty...
one: most all php functions can be used like this
{$foo|replace:"":""} or
{assign var='enddate' value='+30 days'|strtotime}
two: you can use most php function in the if statment...
{if (substr_compare($node->hierarchy, "9.", 0,1)==0)}
I'm the 9th in the menu
{/if}
and the most important thing I've learn... just think php
{assign var=TheValue value=25}
{if ($TheValue & 2)}
I'm just odd
{else}
I'd not be odd but well I'd can't show I'm even
{/if}

these little things really helped me get smarty.. hope they are a help...
Cheers
Jeremy
Re: What is the Smarty code to strip out <h3></h3>
Posted: Tue Oct 13, 2009 1:33 pm
by replytomk3
Much appreciated.
Re: What is the Smarty code to strip out <h3></h3>
Posted: Mon Oct 19, 2009 2:49 pm
by spcherub
Referring to the original post - you were trying to remove the h3 tags from the menu-generated code. You can do this in two other ways:
1. Edit the menu template and remove the tags (this is probably the the most efficient).
2. Use CSS and remove the defaul styling for h3 so it does not display any different from the other text.
Having the menu generate the H3, then trying to strip it out seems like a waste.
FWIW.
S
Re: What is the Smarty code to strip out <h3></h3>
Posted: Mon Oct 19, 2009 3:51 pm
by replytomk3
spcherub wrote:
Referring to the original post - you were trying to remove the h3 tags from the menu-generated code. You can do this in two other ways:
1. Edit the menu template and remove the tags (this is probably the the most efficient).
2. Use CSS and remove the defaul styling for h3 so it does not display any different from the other text.
Having the menu generate the H3, then trying to strip it out seems like a waste.
I could not find how the template for the plain-text menu was generating h3 tag. I think that was inherited from the main stylesheet.
Using CSS to remove styling is something that a little help will be appreciated with.
Re: What is the Smarty code to strip out <h3></h3>
Posted: Tue Oct 20, 2009 1:12 am
by spcherub
Option #1 - fixing the menu template (better IMHO)
If you are using a relatively new version of CMSMS, then the menu manager is definitely using a template to generate the required HTML for the menu section of your page. Normally the name of the template being used is either in the actual menu code in your page template - something that look like {menu template="name_of_template"}. Or if you are using the CMS out-of-the-box, the default template is the one that is probably active - you can find this under Layout > Menu Manager. (Note if you are running out-of-the-box, you will need to first copy the file template into a database template and then edit it from there.) Read the Menu Manager help for additional usage suggestions.
Option #2 - Fix CSS to nullify effect of H3. This does not actually remove the H3 in your code, but effectively removes from doing anything wacky. There are two options.
Option #2-1 - You can want to hide the H3 and anything inside the H3 tags
h3 {display:none;}
Option #2-2 - You want the content that is within the H3 tags but just ignore the styling
h3 {display:inline;font-weight:normal;padding:0;margin:0;font-size:1em;}
(you may need to do more to make the content look "normal" - the the above is a start)
Of course you should make sure that you provide additional selectors (containing div class name or if for instance) to the CSS code above otherwise ann the H3s in your HTML will be affected.
Hope this helps.
S
S
Re: What is the Smarty code to strip out <h3></h3>
Posted: Tue Oct 20, 2009 2:47 am
by replytomk3
Thank you. What I am trying to do is a bottom text-only menu as described in
http://forum.cmsmadesimple.org/index.php/topic,38048.new.html
Re: What is the Smarty code to strip out <h3></h3>
Posted: Tue Oct 20, 2009 11:25 am
by spcherub
I've posted the fix in the other thread. You had a syntax error in your CSS for the footer nav.
S