SOLVED Adding Metadata to a Chronoform page

Lyrical Lou 04 Jan, 2010
How do I go about adding meta keywords and descriptions to a Chronoform in Joomla!

The form code doesn't contain a header tag. Just the code for the form, not the whole page.

Thank you in advance.

Louise
Lyrical Lou 07 Jan, 2010
Anyone got any ideas please?

It just comes up with Joomla! in the meta keywords and description.

Thanks,
Louise
GreyHead 07 Jan, 2010
Hi Louise,

You can of course change them for the whole site in Global Configuration | Site | MetaData Settings.

If you want to change them for the single ChronoForm then include this PHP in the Form HTML on the Form Code tab.
<?php
// workaround for ChronoForms bug
if ( !$mainframe->isSite() ) { return; }

$doc =& JFactory::getDocument();
$doc->setDescription  ('description-string, 'title-string'); 
// general version
$doc->setMetaData( 'tag-name', 'tag-content', true );
// for example . . .
$doc->setMetaData('keywords', 'META, meta element, metadata, metainformation, meta data');
$doc->setMetaData('robots', 'noindex, follow');
// and so on
?>

Bob
Lyrical Lou 07 Jan, 2010
Hi Bob,

Thank you very much.

I have put the code into the top of the form code and I now get an error:

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/wasing/public_html/components/com_chronocontact/chronocontact.html.php(141) : eval()'d code on line 10
Joomla Professional Work
GreyHead 07 Jan, 2010
Hi Louise,

Sorry, I missed a comma in the 'keywords', line. Fixed now.

Bob
Joomla-Newbies 05 Sep, 2011

Thanks Bob.

All working now.



Hi, I am gettting Parse error: syntax error message on my form.
here is the code on my html code.

<?php
// workaround for ChronoForms bug
if ( !$mainframe->isSite() ) { return; }

$doc =& JFactory::getDocument();
$doc->setDescription ('Glasgow computer repair, 'Home visit');
$doc->setMetaData( 'tag-name', 'tag-content', true );
// for example . . .
$doc->setMetaData('glasgow pc repair, west end, east glasgow');
$doc->setMetaData('robots', 'noindex, follow');
?>

Is there anything I am doing wrong, please help. Thanks
GreyHead 05 Sep, 2011
Hi Joomla-Newbies,

Exactly what message are youi getting? This is ChronoForms 3.1 code, the isSite line is no longer required from CFv3.2.

And CFv4 RC2.0 has a new Meta Tagger action that makes this even simpler.

Bob
This topic is locked and no more replies can be posted.