PHP in content
PHP in content
Ok, don't laugh at me. I need to add some PHP code in my content for a DB request. And I know that I have to use other tags than .
I tried searching, but I can't find it anywhere. Help?
I tried searching, but I can't find it anywhere. Help?
Re: PHP in content
I'd say your best bet is to create a user-defined tag and then include that tag in your page.
Int he user-defined tag, leave out , as that is added automatically. The tag you insert on your page is then {nameoftag}. I think that should work.
Int he user-defined tag, leave out , as that is added automatically. The tag you insert on your page is then {nameoftag}. I think that should work.
Re: PHP in content
Since I've got a page mixed HTML and PHP between the lines I echo'ed the HTML so that I only have to use 1 tag. Copy&Pasted the edited code to userdefined plugins, inserted a {Pluginname}-tag into the content and voila... nothing happened 
Can't believe I'm having all these troubles getting my old site adapted...

Can't believe I'm having all these troubles getting my old site adapted...
Re: PHP in content
Here it is. The working script is found here:
http://www.wientanz.com/mitarbeiter/gab ... baelle.php
http://www.wientanz.com/mitarbeiter/gab ... baelle.php
Code: Select all
require "http://www.wientanz.com/mitarbeiter/gabriel/datenbank/include/functions.inc";
echo "<div align=center>";
$res=mysql_query("select count(*) from ball;");
$arr=mysql_fetch_array($res);
$res2=mysql_query("select * from probe group by P_B_ID;");
echo "<p><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"2\">Derzeit haben
wir <b>$arr[0]</b> in unserer Liste, davon <b>".mysql_affected_rows()."</b>
mit Eröffnungsinformationen.</font></p>";
echo "<hr>";
$res = mysql_query("select B_ID, B_Desc, B_Date, B_Ort, B_Price, B_Info, B_EMail, month(B_Date), year(B_Date) from ball ORDER BY B_Date;");
$month=13;
$first=1;
echo "<table width=\"750\" border=\"0\">";
while($arr=mysql_fetch_array($res)) {
if($month!=$arr[7]) { //Print new TableHeader
$month=$arr[7];
$duo=1;
echo "<tr><td> </td></tr>
<tr bgcolor='#000066' bordercolor='#000066'>
<td colspan='6'>
<div align='center'><font size='3' color='#FFFFFF'><b><font face='Arial, Helvetica, sans-serif'><i>";
echo get_full_month($arr[7])." $arr[8]"; echo " </i></font></b></font></div>
</td>
</tr>
<tr bgcolor=#000066>
<td bordercolor=#000066><b><font color=#FFFFFF>Datum</font></b></td>
<td bordercolor=#000066><b><font color=#FFFFFF>Ball</font></b></td>
<td bordercolor=#000066><b><font color=#FFFFFF>Ort</font></b></td>
<td bordercolor=#000066><b><font color=#FFFFFF>Kartenpreise</font></b></td>
<td bordercolor=#000066><b><font color=#FFFFFF>Telefonnummer</font></b></td>
<td bordercolor=#000066><b><font color=#FFFFFF>Probeninfo</font></b></td>
</tr>";
} //End of TableHead
if($duo%2==0) $color="#99CCFF";
else $color="#0099FF";
$duo++;
echo "<tr bgcolor=\"$color\">";
echo " <td bordercolor=\"$color\"><font size=\"2\" face=\"Geneva, Arial, Helvetica, san-serif\">".get_na_string($arr[2])."</font></td>";
echo " <td bordercolor=\"$color\"><font size=\"2\" face=\"Geneva, Arial, Helvetica, san-serif\">".get_na_string($arr[1])."</font></td>";
echo " <td bordercolor=\"$color\"><font size=\"2\" face=\"Geneva, Arial, Helvetica, san-serif\">".get_na_string($arr[3])."</font></td>";
echo " <td bordercolor=\"$color\"><font size=\"2\" face=\"Geneva, Arial, Helvetica, san-serif\">".get_na_string($arr[4])."</font></td>";
echo " <td bordercolor=\"$color\"><font size=\"2\" face=\"Geneva, Arial, Helvetica, san-serif\">".get_na_string($arr[5])."</font></td>";
echo " <td bordercolor=\"$color\"><font size=\"2\" face=\"Geneva, Arial, Helvetica, san-serif\">";
$res2=mysql_query("select P_Link FROM probe where p_b_id='$arr[0]';");
if(!$arr2=mysql_fetch_array($res2))
echo "N/A";
elseif(strlen($arr2[0])>1) echo "<a href=\"$arr2[0]\">Info</a>";
else echo "<a href=\"http://www.wientanz.com/mitarbeiter/gabriel/datenbank/ballinfo.php?B_ID=$arr[0]\">Proben</a>";
echo "</font></td>";
echo "<tr>";
}
echo "</table>
<br><hr><br>
<p><font size='2'>Datenbank wurde zuletzt aktualisiert: "; echo get_last_change(); echo "</font> </p>
<p> </p>
<p> </p>
</div>";
Re: PHP in content
I'm not a real coder
...
But if there's no solution you should try to include this part with Pi_Iframe from CMSMS Forge and you have nothing to change on the source
.

But if there's no solution you should try to include this part with Pi_Iframe from CMSMS Forge and you have nothing to change on the source

Re: PHP in content
I'll try that. Thanks for the idea. Didn't know that something like that exists...
Re: PHP in content
Stupid me, I named the tag wrong. Forgot an "l".
Now the tag works, but what I don't understand is why the umlaute like äüö and other characters like ß,é,è and the likes are displayed wrong. You'll find it here.
http://www.bugovsky.com/index.php?page=Ballkalender
The script is the same as on my original site (see link above) where the characters are correct.
Any ideas?
Now I'm off slipping into my tuxedo. There is a ball in town tonight! (As on any friday and saturday night in January and February in Vienna...)
Now the tag works, but what I don't understand is why the umlaute like äüö and other characters like ß,é,è and the likes are displayed wrong. You'll find it here.
http://www.bugovsky.com/index.php?page=Ballkalender
The script is the same as on my original site (see link above) where the characters are correct.
Any ideas?
Now I'm off slipping into my tuxedo. There is a ball in town tonight! (As on any friday and saturday night in January and February in Vienna...)
Re: PHP in content
An idea: In the DB the data only has the umlaut itself and not the HTML equivalent. i.e. an ä and not an ä
The original script accepts it, but not CMSMS. Any ideas? Don't want to edit over a 160 entries by hand...
The original script accepts it, but not CMSMS. Any ideas? Don't want to edit over a 160 entries by hand...
Re: PHP in content
It is probably to do with character sets, you have no declaration in the web page HTML as far as I can see and it would also depend on the source of your data and perhaps your database settings if this is the source.
A normal html head declaration would be someting like (for UTF-8)
and you are also showing a language on your page of English, which doesn't seem right?
()
Hope this helps
Russ
A normal html head declaration would be someting like (for UTF-8)
and you are also showing a language on your page of English, which doesn't seem right?
()
Hope this helps
Russ
Re: PHP in content
I should also add that with UTF-8 character sets and these types of characters you need to be sending the page the correct sort of entities. e.g. & = & etc.
Have a search for utf-8 character set entities in Google.
Russ
Have a search for utf-8 character set entities in Google.
Russ
Re: PHP in content
You must set the encoding of your template to ISO-8859-1 to show the umlauts right.wientanz wrote: Now the tag works, but what I don't understand is why the umlaute like äüö and other characters like ß,é,è and the likes are displayed wrong. You'll find it here.