<?php echo "HTML" ?> -


this question has answer here:

i new php , have got issue dynamically loaded html-content. i've designed price label, want stored in 1 php-file, make changes apply every position on website:

<?php $preisschild_a = "<div class="centered"><h3>komplett ab</h3></div><div class="preisschild redbg"><div class="preis">";  $preis_neo = "1.000,- €"; $preis_vision55 = "1.000,- €"; $preis_vision80 = "1.000,- €"; $preis_pult = "3.699,- €"; $preis_ultra = "1.000,- €"; $preis_beamcase = "1.000,- €";  $preisschild_b = "</div><div class="preis-subline">zzgl. mwst</div></div><div class="centered"><h3>infos und bestellung:</h3><span class="rot block"><h3>05252/9778511</h3></span></div><hr>";  ?> 

as can see, i've cut whole code 3 pieces, assemble on website again:

<?php echo "$preisschild_a"; ?> <?php echo "$preis_pult"; ?> <?php echo "$preisschild_b"; ?> 

the fact is, whole page keeps beeing white. not work anyway.

where's bug? thanx in advance!

you can't have " character in string starting " unless escape (\").

re-write them this:

$preisschild_a = '<div class="centered"><h3>komplett ab</h3></div><div class="preisschild redbg"><div class="prei">'; 

or

$preisschild_a = "<div class=\"centered\"><h3>komplett ab</h3></div><div class=\"preisschild redbg\"><div class=\"prei\">"; 

make sure same $preisschild_b.

you can have " inside ', can't have same type of quotes unless first escaped \.

also, echo variables, don't have put them in quotes. eg:

<?php echo $preisschild_a; ?> <?php echo $preis_pult; ?> <?php echo $preisschild_b; ?> 

you can put them in double quotes , parse normally, not in single quotes.

eg:

<?php echo '$test';?> //$test 

Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -