Hello maybe simple PHP question but not for me:
I have a case switch code how to leave the complete html in echo statement intact even there are /, ", '. <?php, statement inside without escaping..
i have read about the solutions in php manual
1.)single quotes
2.)escaping
3.)Nowdocs
but what is recomended in chronoforms?
<a id="g_link" href="http://google.com">g_link</a> is only for example ...
I have a case switch code how to leave the complete html in echo statement intact even there are /, ", '. <?php, statement inside without escaping..
i have read about the solutions in php manual
1.)single quotes
2.)escaping
3.)Nowdocs
but what is recomended in chronoforms?
<?php
$lang = \JFactory::getLanguage();
$tag = $lang->getTag();
switch ( $tag ) {
case 'de-DE':
default:
echo '<a id="g_link" href="http://google.com">g_link</a>';
break;
case 'fr-FR':
echo '<a id="g_link" href="http://google.com">g_link</a>';
break;
case 'en-GB':
.
.
.
<?php<?php
$lang = \JFactory::getLanguage();
$tag = $lang->getTag();
switch ( $tag ) {
case 'de-DE':
default:
{ ?>
<a id="g_link" href="http://google.com">g_link</a>
<?php }
break;
case 'fr-FR':
{ ?>
<a id="g_link" href="http://google.com">g_link</a>
<?php }
.
.
.
?>
<a id="g_link" href="http://google.com">g_link</a> is only for example ...
Hi mdma,
Either method will work - I'd probably use the first one but with the " and ' switched around as this lets you insert PHP $variables.
Bob
Either method will work - I'd probably use the first one but with the " and ' switched around as this lets you insert PHP $variables.
<?php
$lang = \JFactory::getLanguage();
$tag = $lang->getTag();
switch ( $tag ) {
case 'de-DE':
default:
echo "<a id='g_link' href='http://google.com/index.php?var={$de_var}'>g_link</a>";
break;
case 'fr-FR':
echo "<a id='g_link' href='http://google.com/index.php?var={$fr_var}'>g_link</a>";
break;
case 'en-GB':
.
.
?>
Note that the {$some_var} syntax only works if the statement is in double quotes "".
Bob
This topic is locked and no more replies can be posted.