Re: Blocklayout/xarpages & dynamic data

"Jason" <[email protected]>
Newsgroups gmane.comp.cms.xaraya.user
Organization Xaraya
Message-ID <[email protected]>
"Christopher Torgalson" <[email protected]> wrote in message 
news:mailman.229.1165821958.6153.xaraya_user-gn8pmO+6nsymdvSpIQae8A@public.gmane.org
> Hello list,
>
> After lurking on the list for a couple of years, I'm finally trying to
> build a Xaraya site. At the moment, I'm trying to add an id attribute
> into the rendering of xarpages' default menu block. The id attribute
> will come from a dynamic data field I added to one of xarpages page
> types. The problem is that in the menu block I'm having trouble
> accessing the value of the dynamic data field, but I can't tell if
> it's a) a problem with my understanding of blocklayout, b) a problem
> with my understanding of xarpages, or c) [unlikely I think...] a bug.
>
> For example, I can use the following snippet in the template:
>
> <ul>
>  <xar:loop name="$page.dd">
>    <li>#$loop:key# =&gt; #$loop:item#</li>
>  </xar:loop>
> </ul>
>
> I assume it's not a problem with variable scope or similar because
> this works, and yields output something like this (as expected):
>
> <ul>
>  <li>page_title =&gt; Lorem Ipsum</li>
>  <li>page_id =&gt; fubar</li>
>  <li>page_content =&gt; Dolor sit amet consectetuer. Lipsum.</li>
> </ul>
>
> The problem arises when I try to access just /one/ of the dd fields like 
> this:
>
> <ul>
>  <xar:loop name="$page.dd">
>    <li>#$loop:item['page_id']#</li>
>  </xar:loop>
> </ul>
>
> ...or like this:
>
> <ul>
>  <xar:loop name="$page.dd">
>    <li>#$loop:item.page_id#</li>
>  </xar:loop>
> </ul>
>
> If I read the blocklayout RFC document correctly, either snippet
> should work, but what happens instead is that instead of the contents
> of ONE field, I get the FIRST CHARACTER of EACH field, something like
> this (assuming the same set of fields as shown in the output above):
>
> <ul>
>  <li>L</li>
>  <li>f</li>
>  <li>D</li>
> </ul>
>
> I have no idea what backasswards thing I may have done or what
> blocklayout/xarpages subtlety I've overlooked, but it sure /looks/
> like I've set things up correctly. If anyone has any comments advice,
> suggestions or even educational personal abuse, I'd be happy to listen
> to it...

The menu block template already accesses the 'menu_title' DD field to 
display the menu items. Do a search through the templates for that, and see 
how that works. It will generally by $pages.{pid}.dd.{dd_name}, or 
$current_page.dd.{dd_name} where {pid} is the page ID and {dd_name} is the 
name of the DD property.

-- JJ
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.