Jump to content

Adding $record to the listing template


Meddysong

Recommended Posts

Posted

In one of my databases I don't need to use the listing view. There's no need for people to leave comments or reviews and there's nothing to read. It's for audio pronunciations, so instead of taking you to the display view, clicking the record title plays the audio.

What I'd like to do is add the link to report the recording to the listing view. I know that to do that I have to add

 {{if !\IPS\Member::loggedIn()->group['gbw_no_report'] }}
		&nbsp;&nbsp;<a href='{$record->url('report')}' data-ipsDialog data-ipsDialog-size='medium' data-ipsDialog-title="{lang="content_record_report" sprintf="$record::database()->recordWord( 1, TRUE )"}" data-ipsDialog-remoteSubmit data-ipsDialog-flashMessage="{lang="report_submit_success"}" title="{lang="content_record_report" sprintf="$record::database()->recordWord( 1, TRUE )"}">{lang="content_record_report" sprintf="$record::database()->recordWord( 1, TRUE )"}</a>
	{{endif}}

to the recordRow template, but my problem is that it uses the variable $record, which I don't know how to define.

Could anybody give me a pointer, please?

Posted

I don’t know about that specific use, but in general you would just replace $record with $row. So $record->_title would not work in a listing template, but $row->_title for example. 

Posted

That worked perfectly - thanks, Ralf!

One curious feature is that the template already contained {wordbreak="$record->_title"} (even though $record isn't an attribute and I can't see it defined manually) and when I changed that one to $row, it messed up. I'm not sure I understand why $record not only already existed in the template there but was also necessary, and yet its inclusion by me later gave me the great white screen, until I followed your advice and changed them to $row. Just when I think I'm starting to better understand how these things work, there's always the reminder that I've barely started yet :(

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...