Fiji Web Design
Welcome, Guest
Please Login or Register.    Lost Password?
Re:Plugin 1.5 (1 viewing) (1) Guest
Go to bottom Post Reply Favoured: 0
TOPIC: Re:Plugin 1.5
#365
Infodine (User)
Fresh Boarder
Posts: 2
graphgraph
User Offline Click here to see the profile of this user
Plugin 1.5 3 Years, 2 Months ago Karma: 0  
Hi,

I installed your plugin and would like to add a menu in my content. I was thinking of including the menu code in your plugin so that it will display. I see there is a section called 'After Title'. I would like this menu on the line after the article title so I thought this would be a good spot. I tried echo and I get no output.

Would I have to modify the $row-> variable somehow? More sample code would be a big asset to people trying to use the plugin and don't have extensive knowledge of the Joomla structure.

Basically I want to insert some output (a custom menu) on the line after the title, for every article listed on the page.

Thanks,

Infodine
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#366
admin (Admin)
Admin
Posts: 475
graph
User Online Now Click here to see the profile of this user
Re:Plugin 1.5 3 Years, 2 Months ago Karma: 10  
Hi Infodine,

Aftertitle and Onprepare are the same you have to edit the article and parameters objects to make changes.

Joomla Docs says the aftertitle event passes parameters by value, but this is incorrect documentation.
http://dev.joomla.org/component/option,com_jd-wiki/Itemid,/id,plugins:content_events/

The parameters are passed by reference and you can edit them in the aftertitle event to get changes.

In Joomla1.5 the article object is named $article.

So if you wanted to change the title:

$article->title = 'new title';
If you wanted to change the page title:
$params->set('page_title', 'New Page Title');
To add menu below the title, its probably best to do:
$article->text = '<div>my menu</div>'.$article->text;
Or you could just echo the menu in the onprepare event. It renders under the page title in J1.5.
 
Report to moderator   Logged Logged  
 
Last Edit: 2008/11/22 04:39 By admin.
  The administrator has disabled public write access.
#367
Infodine (User)
Fresh Boarder
Posts: 2
graphgraph
User Offline Click here to see the profile of this user
Re:Plugin 1.5 3 Years, 2 Months ago Karma: 0  
Hello,

Thank you so much for the quick response. I viewed the Joomla document which was informative. Do you have a link to a document that will show me all the parameters allowed for $article-> ?

I noticed you can access the database fields like $article->created_by_alias and
I'm now stuck on getting the linked Section and Category from the article.

I have it set in the global article parameters fo have the linked Section and
Category at the top of the articles. So it is there, just wondering if I can
access it with your plugin.

Thanks again!

Infodine
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#368
admin (Admin)
Admin
Posts: 475
graph
User Online Now Click here to see the profile of this user
Re:Plugin 1.5 3 Years, 2 Months ago Karma: 10  
Try doing a var_dump() or print_r() on an object to get its properties.

eg:

echo '<pre>'.print_r($article, true).'</pre>';
That should give you a formatted list of properties of $article. You can add die; after that so you don't have to load the whole page. To get the methods of an Object Instance, use get_class_methods(). eg:
echo '<pre>'.print_r(get_class_methods($params), true).'</pre>';
That usually gets what you want faster then digging through documentation.

Also look at get_defined_vars() and related functions: http://www.php.net/manual/en/function.get-defined-vars.php

If you do this regularly install XDebug on your development server. It gives you a trace of php execution, object's and their properties, scope etc.

http://www.xdebug.org/
http://onwebdevelopment.blogspot.com/2008/06/php-code-performance-profiling-on.html

Also take a look at PHP5 Reflection:
http://www.php.net/oop5.reflection
 
Report to moderator   Logged Logged  
 
Last Edit: 2008/11/23 00:18 By admin.
  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.