Hi,
I’ve run across some strange behaviour with channel entries and url segments.
I have the following url pattern:
<a href="http://somedomain.com/index.php/clients/lightbox-photo/19/7669">http://somedomain.com/index.php/clients/lightbox-photo/19/7669</a>In this case, {segment_3} refers to the entry_id I want the Channel Entries tag in the template to display as a single entry page. {segment_4} (which has value of 7669) has nothing to do with the Channel Entry—it’s actually the value of a Matrix field, which I need to use within the (lightbox-photo) template.
My problem is that the Channel Entries tag is evaluating BOTH segments. Segment 3 is being interpreted (correctly) as the entry id. Segment 4 is being evaluated (incorrectly, I think?) as the url_title. BOTH are being evaluated by the Channel Entries tag—thus I get no results!
Here’s the SQL that’s being generated:
SELECT t.entry_id FROM exp_channel_titles AS t
LEFT JOIN exp_channels ON t.channel_id = exp_channels.channel_id
LEFT JOIN exp_members AS m ON m.member_id = t.author_id
WHERE t.entry_id !='' AND t.site_id IN ('1') AND t.entry_date < 1306038209
AND (t.expiration_date = 0 OR t.expiration_date > 1306038209) AND t.entry_id = '19'
AND t.channel_id = '11' AND t.url_title = '7669' AND t.status = 'open'
ORDER BY t.sticky desc, t.entry_date desc, t.entry_id desc LIMIT 0, 1I’ve not encountered this before. I’m pretty sure EE isn’t supposed to work that way?
Any pointers would be appreciated.
Thanks,
Brett