Fiji Web Design
Welcome, Guest
Please Login or Register.    Lost Password?
Re:How to add additional text (1 viewing) (1) Guest
Go to bottom Post Reply Favoured: 0
TOPIC: Re:How to add additional text
#632
p0oo9ip0o (User)
Fresh Boarder
Posts: 11
graphgraph
User Offline Click here to see the profile of this user
Re:How to add additional text 3 Years ago Karma: 0  
Fatal error: Call to a member function setQuery() on a non-object in /home/p0oo9ip0o/public_html/plugins/content/botphp_content.php(53) : eval()'d code on line 4

I saw this fatal error when i use this

<?php $query = "SELECT title FROM #__categories WHERE id = ".intval($article->catid)." LIMIT 1";  
$database->setQuery($query);  
$category = $database->loadResult();
$custom_text = 'this '.$article->title.' belongs to'.$category;
$article->text = str_replace('{additionaltext}', $custom_text, $article->text); ?
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#633
admin (Admin)
Admin
Posts: 475
graph
User Online Now Click here to see the profile of this user
Re:How to add additional text 3 Years ago Karma: 10  
You need to retrieve the Database Class Instance to the scope of your code. The event plugins execute in a local scope. (That is, global objects are not available).

$database =& JFactory::getDBO();
Place that before any code where you use $database.
 
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.