Jump to content

Use php in database article


adcantu

Recommended Posts

Posted

Hello I have created a pages database and made a text area field allowing raw html. Only a specific trusted group will have access to edit the articles in the database.

However I noticed I am not able to use php in the html. For example I can't call theme resource images. Is there a way to get this to work? 

Another example, I wanted to use an array as well like in the example here 

 

 

{{$servers = array('192.223.28.120:27014' => "Operation", '192.223.28.120:27015' => "Realism", '192.223.28.120:27016' => "Tactical Co-Op", '192.223.28.120:27017' => "Training", '192.223.28.120:27018' => "Day of Infamy", '192.223.28.120:27019' => "Fun Co-Op");}}
<ul class='ipsList_inline>
{{foreach $servers as $ip => $title}}
        <li>
   {$title} : {$ip}
        </li>
   {{endforeach}}
</ul>

My code gets printed as text only though.

Posted

Sorry, it is not possible to utilize PHP in the editor. To add images to the editor is fairly easy and does not require PHP.

If you're looking to utilize the same image over and over again in the same spot. You may want to utilize a template (where you can use PHP) and some sort of dropdown as a database field to signify which image is used in that spot.

Posted

As suggested, just create your own versions of the Pages templates the database uses. Within those templates, you can do whatever you need.

5939736759142_ScreenShot2017-06-08at17_53_46.thumb.png.7c83c4f14c500770835fe22aabe6b65f.png

It wouldn’t be very elegant (or secure) to put these things in an editor field. 

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...