Error when inserting the autonav block into header.php
Permalink
Hi There,
I'm trying to insert the autonav block permanently into my header.php file but get an error:
"Parse error: syntax error, unexpected T_VARIABLE in /Path/to/header.php on line 68"
Here is my call:
I initially created a header area then added autonav blocks via the c5 UI - do I have to delete those blocks before inserting the nav into header.php or is this error simply a mistake in my syntax?
Sorry, very new to c5 and php - any suggestions would be much appreciated.
Cheers
Ben
I'm trying to insert the autonav block permanently into my header.php file but get an error:
"Parse error: syntax error, unexpected T_VARIABLE in /Path/to/header.php on line 68"
Here is my call:
<?php $autonav = BlockType::getByHandle('autonav') $autonav->controller->orderBy = 'display_asc'; $autonav->controller->displayPages = 'top'; $autonav->render('templates/header_menu'); ?>
I initially created a header area then added autonav blocks via the c5 UI - do I have to delete those blocks before inserting the nav into header.php or is this error simply a mistake in my syntax?
Sorry, very new to c5 and php - any suggestions would be much appreciated.
Cheers
Ben
BTW, I highly recommend not putting all of your php code onto one line -- especially when you're first learning -- because it makes it harder to read and hence more difficult to spot bugs. I realize it's super ugly in your markup but in my opinion it's worth the tradeoff (ugly working code is better than pretty non-working code :)
-Jordan