insert attributes into anchor tags created by nav object

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

insert attributes into anchor tags created by nav object

mail
In the nav object, I would like the links to have a specific attribute inserted. How best to accomplish that? I thought that the "param" parameter in the insert method would allow me to specify param or params that should be sent along with nav links, but i not sure what it means "sent along" I was hoping it meant links would include the parameters I submit, for example:

    $nav->(insert(
        -key='logout',
        -label='Logout',
        -param='data-ajax="false"'));

would end up creating a link

<a href="/logout/" data-ajax="false">Logout</a>

That did not happen though. Is there some way to accomplish that? Or do i need to mangle the renderhtml output?

[(String_Replace:-Find='<a',-Replace='<a data-ajax="false"',$nav->renderhtml)]

Maybe that is OK if I want ALL links to be replaced, but will be very tricky if I only want select links to have data-ajax="false"

-- 

#############################################################

This message is sent to you because you are subscribed to

the mailing list <[hidden email]>.

To unsubscribe, E-mail to: <[hidden email]>

Send administrative queries to  <[hidden email]>

List archive http://lasso.2283332.n4.nabble.com/Knop-Framework-Discussion-f3157831.html

Project homepage http://montania.se/projects/knop/

Google Code has the latest downloads at http://code.google.com/p/knop/


	
	
	
	
Reply | Threaded
Open this post in threaded view
|

Re: insert attributes into anchor tags created by nav object

stevepiercy
On 2/27/11 at 4:43 PM, [hidden email] pronounced:

> In the nav object, I would like the links to have a specific attribute inserted. How
> best to accomplish that? I thought that the "param" parameter in the insert method
> would allow me to specify param or params that should be sent along with nav links,
> but i not sure what it means "sent along" I was hoping it meant links would include
> the parameters I submit, for example:
>
>    $nav->(insert(
>       -key='logout',
>       -label='Logout',
>       -param='data-ajax="false"'));
>
> would end up creating a link
>
> <a href="/logout/" data-ajax="false">Logout</a>

-param is GET parameters.

Use -template.  For example:

    records;
        local('da') = '#link# data-ajax="'+field('myfield')+'#/link#';
        $subnav->insert(
            -key=field('key'),
            -label=field('label'),
            -data=field('title'),
            -filename='cms',
            -class=('nav'+field('key')),
            -template=#da,
            -hide=(field('show_nav') == 'N' ? true | false));
    /records;

--steve

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Steve Piercy               Web Site Builder               Soquel, CA
<[hidden email]>                  <http://www.StevePiercy.com/>


--
#############################################################
This message is sent to you because you are subscribed to
the mailing list <[hidden email]>.
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
List archive http://lasso.2283332.n4.nabble.com/Knop-Framework-Discussion-f3157831.html
Project homepage http://montania.se/projects/knop/
Google Code has the latest downloads at http://code.google.com/p/knop/