Fiji Web Design
Welcome, Guest
Please Login or Register.    Lost Password?
Example Code for PHP Content Plugin for Joomla 1.0 (1 viewing) (1) Guest
Go to bottom Post Reply Favoured: 0
TOPIC: Example Code for PHP Content Plugin for Joomla 1.0
#10
admin (Admin)
Admin
Posts: 475
graph
User Online Now Click here to see the profile of this user
Example Code for PHP Content Plugin for Joomla 1.0 3 Years, 7 Months ago Karma: 10  
The content plugin allows you to manipulate Joomla's article content before they are displayed.

When in a content plugin in Joomla, the article is represented by the object $row in Joomla 1.0. This $row is the result of a database query for the article, and thus contains the article title in $row->title, the article text in $row->text etc.

To modify the text of an artile in Joomla 1.0 we have to modify $row->text.

Example:

We want to add a horizontal line after every article. A horizontal line is <br />
<?php


$row->text .= '<br />';


?>
Thats it. Notice the dot before the = sign. (.=). This appends to the string.
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#25
admin (Admin)
Admin
Posts: 475
graph
User Online Now Click here to see the profile of this user
Re:Example Code for PHP Content Plugin for Joomla 1.0 3 Years, 7 Months ago Karma: 10  
Replace all occurances of {sitename} with your Joomla site name.

<?php
global $mainframe;
if (isset($row->text)) {
	$row->text = str_replace('{sitename}', $mainframe->getCfg('sitename'), $row->text);
}
?>
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#26
admin (Admin)
Admin
Posts: 475
graph
User Online Now Click here to see the profile of this user
Re:Example Code for PHP Content Plugin for Joomla 1.0 3 Years, 7 Months ago Karma: 10  
Replace all occurrences of {adsense} with a Google Adsense Ad.

$adsense = '
<script type="text/javascript"><!--
google_ad_client = "pub-0553268877774585";
google_ad_width = 468;
google_ad_height = 60;
google_ad_format = "468x60_as";
google_ad_type = "image";
//2007-03-06: fiji web design
google_ad_channel = "9343350244";
google_color_border = "FFFFFF";
google_color_bg = "FFFFFF";
google_color_link = "FF6600";
google_color_text = "000000";
google_color_url = "FF6633";
//--></script>

<script type="text/javascript"
  src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
';

if (isset($row->text)) {
	$row->text = str_replace('{adsense}', $adsense, $row->text);
}
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#981
igormoskov (User)
Fresh Boarder
Posts: 1
graphgraph
User Offline Click here to see the profile of this user
Re:Example Code for PHP Content Plugin for Joomla 2 Years, 7 Months ago Karma: 0  
Hello All!
Can u answer me where i can get this mambot for joomla 1.0.15? There is only for joomla 1.5 on this page http://code.google.com/p/joomla-php/downloads/list
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
Go to top Post Reply
Powered by FireBoardget the latest posts directly to your desktop

Joomla Downloads

DownloadsDownload our free Joomla! Components, Modules and Plugins.