URL attribute and HREF in template

Author Message

H. K.

Monday 03 March 2008 12:02:40 pm

Hi, I have created a content class(video remote), which contains a Text string, image and URL attribute.
I want to create a section on my FrontPage containing the image and string text string, which link to the url in the URL attribute.

I have attempted to use the following code, but it does not work

{let video2=fetch( content, tree, hash( parent_node_id, 2,
                                           limit, 2,
                                           sort_by, array( published, false() ),
                                           'class_filter_array', array( 37 ),

                                            ) )}

<div id="video2">
{section var=video2 offset=1 max=1 loop=$video2}
 
   <div class="child">
 
 <a href={$video2.item.url} rel="gb_page_fs[]"> {attribute_view_gui attribute=$video2.item.data_map.image=video_remote}
     
   
 {$video2.item.name|wash}</a>
   
   
   </div>
{/section}

</div>
{/let}

Felix Laate

Monday 03 March 2008 1:04:01 pm

Hi there,

you could try something like this:

{def $video=fetch( content, tree, hash( parent_node_id, 2,
                                          limit, 2,
                                          sort_by, array( published, false() ),
                                          'class_filter_array', array( 37 ),
                                           ) )}

{foreach $video as $vid}

{attribute_view_gui attribute=$vid.data_map.image url=$vid.data_map.url.content}
<a href={$vid.data_map.url.content|ezurl()}>{$vid.name|wash}</a>

{/foreach}

{undef $video}

PS! Taken directly out of my sleepy brain..

Felix

Publlic Relations Manager
Greater Stavanger
www.greaterstavanger.com

H. K.

Tuesday 04 March 2008 6:01:59 am

Thanks for showing the def solution, I always used let which is deprecated according to the 4.0 manual

One more thing, I see that on Din Mat you use at lot of ajax.

What is the proper way to include ajax scripts in ez link?

I have attempted to use a script called greybox to open external links on my page, but EZ 4 interferes with the links so that the redirection script always links to 0

 

<a href={$vid1.data_map.url.content|ezurl()} rel="gb_page_fs[]">{$vid1.name|wash}</a>

nehal shah

Tuesday 21 December 2010 3:03:18 am

Our system publish article from eZ-Publish. Now i want article list country wise, but it seems impossible right now. I have tried that i fetch country from url, but it is also not possible.If you guys have an idea pls tell me.

Thanx in advance.

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.