Forum

Thread tagged as: Addons

Event title in browser

Hi there Simple one no doubt but can't get it to work.

What is the code I need to output the Event Title in the Browser TITLE bar? Currently using:

<title><?php perch_events_event_field(perch_get('s'), 'eventTitle'); ?></title>

but it's not working.

Thanks

Rich

Rich Hemery

Rich Hemery 0 points

  • 6 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

That should work. What happens?

It's blank after the middot (it should say Romantic night away only £79)

My code is: <title>Love Bedford Offers · <?php perch_events_event_field(perch_get('s'), 'eventTitle'); ?></title>

A page is here: https://www.lovebedfordoffers.co.uk.gridhosted.co.uk/offers/offer.php?event=2015-01-29-romantic-night-away-only-79

I think you need to add true at the end so it outputs it raw. So like so...
<?php perch_events_event_field(perch_get('s'), 'eventTitle', true); ?>

Drew McLellan

Drew McLellan 2638 points
Perch Support

If you turn debug on for the page, what does it output?

Hi Drew I have debug on now on the page: https://www.lovebedfordoffers.co.uk.gridhosted.co.uk/offers/offer.php?event=2015-01-29-romantic-night-away-only-79

Have tried it with your suggestion Terry but still outputting nothing.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Your event slug is event on the query string, so change:

perch_get('s')

to

perch_get('event')

Thanks Drew, got it working.

Another query, I'm trying to grab the company name to put into the TITLE too but I can only seem to get eventTitle to work whilst CompanyName (the ID) doesn't?

         <title>Love Bedford Offers · <?php perch_events_event_field(perch_get('event'), 'eventTitle'); ?> at <?php perch_events_event_field(perch_get('event'), 'CompanyName'); ?></title>

Still having issue getting the above to work, would be grateful for a solution.

Drew McLellan

Drew McLellan 2638 points
Perch Support

If you need more than one field you should just use a template and perch_events_custom()