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.

eZ debug

Timing: Jan 18 2025 03:09:07
Script start
Timing: Jan 18 2025 03:09:07
Module start 'layout'
Timing: Jan 18 2025 03:09:07
Module start 'content'
Timing: Jan 18 2025 03:09:08
Module end 'content'
Timing: Jan 18 2025 03:09:08
Script end

Main resources:

Total runtime0.9081 sec
Peak memory usage4,096.0000 KB
Database Queries62

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0055 589.1484152.6250
Module start 'layout' 0.00550.0029 741.773439.4453
Module start 'content' 0.00840.8980 781.2188579.7109
Module end 'content' 0.90640.0017 1,360.929712.1563
Script end 0.9081  1,373.0859 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00360.3928160.0002
Check MTime0.00160.1728160.0001
Mysql Total
Database connection0.00070.076110.0007
Mysqli_queries0.849293.5127620.0137
Looping result0.00060.0610600.0000
Template Total0.868095.620.4340
Template load0.00220.242520.0011
Template processing0.865895.332420.4329
Template load and register function0.00020.024010.0002
states
state_id_array0.00100.114510.0010
state_identifier_array0.00130.143220.0007
Override
Cache load0.00180.2018240.0001
Sytem overhead
Fetch class attribute can translate value0.00060.069030.0002
Fetch class attribute name0.00150.161150.0003
XML
Image XML parsing0.00090.094430.0003
class_abstraction
Instantiating content class attribute0.00000.001250.0000
General
dbfile0.00870.9595160.0005
String conversion0.00000.001040.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
4content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
1content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
5content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
3content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 16
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs