I'm working with a custom autonav in the Concrete5 CMS - but I think this might be more of a general PHP question. I'm having a hard time figuring out if it is possible to do the following.
I have some autonav code that looks like this:
<?php defined('C5_EXECUTE') or die("Access Denied."); ?>
<?php
$nav = BlockType::getByHandle('autonav');
$nav->controller->orderBy = 'display_asc';
$nav->controller->displayPages = 'custom';
$nav->controller->displayPagesCID = '135';
$nav->controller->displaySubPages = 'all';
$nav->controller->displaySubPageLevels = 'all';
$nav->render('tertiary');
?>
I also have a text field that outputs via the following code:
<?php if (!empty($field_4_textbox_text)): ?>
<?php echo htmlentities($field_4_textbox_text, ENT_QUOTES, APP_CHARSET); ?>
<?php endif; ?>
What I'd like to do is have the text output within this line of the autonav code:
$nav->controller->displayPagesCID = '135';
Instead of the hard coded 135, I'd like the text outputted by $field_4_textbox_text to display within those single quotes. Something like:
$nav->controller->displayPagesCID = 'echo $field_4_textbox_text';
But that doesn't work. Nothing I've done works. Is there something obvious I might be missing? I'm feeling clueless.
Thanks!
Use double quotes to parse variables, single quotes can never parse variables in php
$nav->controller->displayPagesCID = " $field_4_textbox_text";