Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
QUESTION PHP How to add class to div
#1
Whats the php code snippet to add another class to live site div class?.
Like if i have < div class="potato"> which appears only in live site, not codet to template file, and i want to add another class like carrot to that div, so its then like < div class =" potato carrot " >
Reply
#2
not sure if I understand correctly what you're asking, but where does the <div class="potato"> come from ? When is the potato class added to this div?

PHP is not for "live editing", it can generate a html code on server, but can't edit in after displaying to user, for that you need to use Javascript (but it really depends on what you're trying to achieve, if the JS is really needed)
Reply
#3
(2017-06-14, 00:04:59)morvy Wrote: not sure if I understand correctly what you're asking, but where does the <div class="potato"> come from ? When is the potato class added to this div?

Might it be added to a page in the source editor part of the page editor?

It can be done with plugin GS Custom Settings. You edit a page in de source modus. You make a div and set the class to potato
Code:
<div class="potato">bla</div>
Then you add the in page code for GS Custom Settings. In the admin interface you set the setting to carrot. The code in the source view would become something like:
Code:
<div class="potato (% setting: test1/new_setting %)">bla</div>
Reply




Users browsing this thread: 1 Guest(s)