What is the Smarty code to strip out <h3></h3>

For discussion and questions related to CMS Specific templates and stylesheets (CSS), and themes. or layout issues. This is not a place for generic "I don't know CSS issues"
Locked
replytomk3

What is the Smarty code to strip out <h3></h3>

Post 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?
replytomk3

Re: What is the Smarty code to strip out <h3></h3>

Post 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}
JeremyBASS

Re: What is the Smarty code to strip out <h3></h3>

Post 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
replytomk3

Re: What is the Smarty code to strip out <h3></h3>

Post by replytomk3 »

naive question: can I do this without any assignments to variables?

Note to self: stay away from Smarty.
JeremyBASS

Re: What is the Smarty code to strip out <h3></h3>

Post 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}

:D these little things really helped me get smarty.. hope they are a help...

Cheers
Jeremy
replytomk3

Re: What is the Smarty code to strip out <h3></h3>

Post by replytomk3 »

Much appreciated.
spcherub
Power Poster
Power Poster
Posts: 402
Joined: Fri Jun 06, 2008 5:54 pm

Re: What is the Smarty code to strip out <h3></h3>

Post 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
replytomk3

Re: What is the Smarty code to strip out <h3></h3>

Post 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.
spcherub
Power Poster
Power Poster
Posts: 402
Joined: Fri Jun 06, 2008 5:54 pm

Re: What is the Smarty code to strip out <h3></h3>

Post 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
replytomk3

Re: What is the Smarty code to strip out <h3></h3>

Post 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
spcherub
Power Poster
Power Poster
Posts: 402
Joined: Fri Jun 06, 2008 5:54 pm

Re: What is the Smarty code to strip out <h3></h3>

Post by spcherub »

I've posted the fix in the other thread. You had a syntax error in your CSS for the footer nav.

S
Locked

Return to “Layout and Design (CSS & HTML)”