Okay guys, so here is my problem. I am working on a website for a friend of mine and I have a section near the footer where I want to add some short cta's. I can't post images yet, since this is my first post, but you can have a look at the site so far right here: http://aev.martenzander.com/
Now I have outsourced this part of the site as a php-include to have better control of it. Since I will add this part on every single page of the site, but try to have different text on every page, I wonder how to creat a JSON master file, where i can write down all the text that will ever be used in that section. Is there a way to tell my HTML where to get the Text, if a special site.php gets loaded?
This is my "teaser_section" include:
<div class="teaser_wrapper">
<div class="teaser_section">
<ul>
<div class="teaser one">
<h1>Kontaktieren Sie uns!</h1>
<p>ACTIVUM e.V.</br>Mittelweg 12</br>31559 Haste</p>
<p>Tel.: 0 57 23 - 56 75</br>E-Mail: <a href="mailto:info@activum-ev.de">info@activum-ev.de</a></p>
</div>
<div class="teaser two">
<h1>Möchten Sie Mitglied werden?</h1>
<p>Hier geht's zum Anmeldeformular.</p>
<button onclick="self.location.href='anmeldeFormular.php'">Anmeldeformular</button>
</div>
<div class="teaser three">
<h1>Leistungen</h1>
<p>Wenn Sie dem ACTIVUM e.V. beitreten möchten, können Sie alle Leistungen in Anspruch nehmen.</p>
<button onclick="self.location.href='leistungen.php'">Leistungen</button>
</div>
<div class="teaser four">
<h1>Beratungsstellen</h1>
<p>Wir suchen immer nach neuen Mitarbeitern und potentiellen neuen Beratungsstellen in unserer Umgebung.</p>
<button onclick="self.location.href='beratungsStellen.php'">Beratungsstellen</button>
</div>
</ul>
</div>
It would be possible to write the text into a JSON and include parts of it via JavaScript into your page. However this would not be the best method, since it would not allow search engines and people with JavaScript disabled to see the text.
What i would do to create an XML file on your Server and write everthing in there. Then you can open your XML file in PHP with simplexml_load_file ("filename")
.
The PHP could check on which page you are currently on and then echo the required parts to the client.
To read more about how to handle XML with PHP read PHP.net