Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > RocketCake
Insert PHP code into a string.

stevec
Registered User
Quote
2019-03-19 12:06:37

I have started to use RocketCake but it is not behaving as I would expect. I have numerous situations where I need to insert a php variable into a text string.

I managed to do this by inserting a container and setting the relevant styles etc. I then entered my text - no problem. I then inserted a php container with no div around the code, followed by more text. the code I get is

<div id="container_798910f0">
<div id="container_798910f0_padding" >
<div class="textstyle4">
<span class="textstyle3">This is a </span>
<?PHP
echo "test";
?> <span class="textstyle3"> message.</span>
</div>
<div style="clear:both"></div>
</div>
</div>

This works but because the php code is excluded from the span it does not have the correct formatting. The code that works correctly is

<div id="container_798910f0">
<div id="container_798910f0_padding" >
<div class="textstyle4">
<span class="textstyle3">This is a
<?PHP
echo "test";
?> message.</span>
</div>
<div style="clear:both"></div>
</div>
</div>

Is there any way that this can be achieved with RocketCake?


erik
Registered User
Quote
2019-03-20 07:04:22

Never tried something like this, but maybe you could even just enter that "<?PHP" text directly on the page as text. Not sure if RocketCake will replace the > with & lt ;, though.


stevec
Registered User
Quote
2019-03-20 11:10:17

As you assumed RocketCake replaces the < and > with their entities as they are reserved characters so will not work.

I can overcome this by setting the style in the php echo statement but it would have been easier if the code was included in the div.

echo "<span style='font-size:18pt; font-family:Arial, Helvetica, sans-serif;'> $login </span>";


The reason for wanting to do this is that I run a couple of sites for annual horse shows and need to change things such as the year on the whole website. It is easier to make the changes using a php variable than go through the whole site and change each occurrence.


niko
Moderator
Quote
2019-03-22 08:43:30

True, maybe a feature like this could be added in a future update. Will think about that.


Create reply:


Posted by: (you are not logged in)


Enter the missing letter in: "Internatio?al" (you are not logged in)


Text:

 

  

Possible Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Image [img]http://www.example.com/image.jpg[/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons


   






Copyright© Ambiera e.U. all rights reserved.
Privacy Policy | Terms and Conditions | Imprint | Contact