Getting Page name

Discussion and education for beginner / novice programmers interested in embarking on the development process to take advantage of the extensible nature of the Joomla! CMS.

Moderators: tjay, seadap, Rogue4ngel, matthewhayashida

Forum rules
Post Reply
Smav
Joomla! Fledgling
Joomla! Fledgling
Posts: 4
Joined: Thu Apr 12, 2007 4:14 am

Getting Page name

Post by Smav » Sun Sep 23, 2007 7:12 pm

Hi there,

I am new to joomla and PHP, but have extensive experience in ASP.net.  I would like to know how to simply output the page name, or the "itemid" to the page, so that I can input it into a flash movie i am using for the menu on my site.

Can any brave soldier assist me with this?

Also, one of the things i did like about .net was the extensive documentation and samples that were packaged with it (.net 2.0 SDK documentation).  The .net documentation, outlines all of the commands you could use in C# as well as examples of usage. Can someone tell me if i can download such a thing for PHP, or access a website that will provide me with this data?

Thanx,

Gavan

User avatar
ianmac
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 237
Joined: Sat Sep 24, 2005 11:01 pm
Location: Toronto, Canada

Re: Getting Page name

Post by ianmac » Sun Sep 23, 2007 7:41 pm

Head over to php.net for a reference of the PHP language.

To get the pagename, you do:

Code: Select all

$document =& JFactory::getDocument();
echo $document->getTitle();


Ian
Help test my Component XML Generator Tool!
http://extensions.joomla.org/component/option,com_mtree/task,viewlink/link_id,1997/Itemid,35/
All feedback appreciated!

Smav
Joomla! Fledgling
Joomla! Fledgling
Posts: 4
Joined: Thu Apr 12, 2007 4:14 am

Re: Getting Page name

Post by Smav » Sun Sep 23, 2007 8:28 pm

Thanx Ian,

Much appreciated

Smav
Joomla! Fledgling
Joomla! Fledgling
Posts: 4
Joined: Thu Apr 12, 2007 4:14 am

Re: Getting Page name

Post by Smav » Sun Sep 23, 2007 8:43 pm

I'm getting an error: "Fatal error: Class 'JFactory' not found in C:\sites\premium6\lomaxgroup\webroot\joomla\templates\lomaxgroup\index.php on line 29"

I assume i have to include and/or install the JFactory Library, How do I do this?

Smav
Joomla! Fledgling
Joomla! Fledgling
Posts: 4
Joined: Thu Apr 12, 2007 4:14 am

Re: Getting Page name

Post by Smav » Sun Sep 23, 2007 9:02 pm

I guess i should have stated that i have 1.0 installed.

User avatar
tjay
Joomla! Intern
Joomla! Intern
Posts: 73
Joined: Thu Aug 18, 2005 1:50 am
Location: New Orleans
Contact:

Re: Getting Page name

Post by tjay » Sun Sep 23, 2007 9:06 pm

Most likely your missing and include
this is at the top of content.php component

defined('_JEXEC') or die();

jimport('joomla.application.component.controller');
This day it is my wish that I helped you to live

User avatar
tjay
Joomla! Intern
Joomla! Intern
Posts: 73
Joined: Thu Aug 18, 2005 1:50 am
Location: New Orleans
Contact:

Re: Getting Page name

Post by tjay » Sun Sep 23, 2007 9:08 pm

Ah your in the wrong forum

this is 1.5 coding 101
This day it is my wish that I helped you to live


Post Reply