I have code in chronoforms to get the page title for an email each time someone fills the form. However, I'm always getting the page title with extra data.
For example:
"Empodera tu ser con PNL - Fundación Empoder"
I'd like to remove the
" - Fundación Empoder"
But I can't find an answer
<input type='hidden' name='page_url' id='page_url' value='<?php echo \JURI::getInstance()->toString(); ?>' />
<?php
$jdoc = \JFactory::getDocument();
?>
<input type='hidden' name='page_title' id='page_title' value='<?php echo $jdoc->getTitle(); ?>' />
Thanks in advance if you can help :D
Rodrigo
Check out
str_replace():This probably isn't the most elegant solution but, it'll certainly work if the part you want to remove is constant. Otherwise, you'll need to get creative and perhaps look into pattern matching/regex/etc.