The Joomla! Forum ™



Forum rules


Please use the mailing list here: http://groups.google.com/group/joomla-dev-general rather than this forum.



Post new topic Reply to topic  [ 7 posts ] 
Author Message
PostPosted: Tue Mar 17, 2009 12:29 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Thu Feb 05, 2009 5:11 pm
Posts: 5
I am creating a sort of breadcrumbs module that supports subcats and was wondering how to pull the article id of the current page being visited. Any thoughts? Thanks


Top
 Profile  
 
PostPosted: Tue Mar 17, 2009 12:45 pm 
Joomla! Enthusiast
Joomla! Enthusiast

Joined: Thu Feb 19, 2009 9:57 am
Posts: 110
Location: Cambridgeshire / Hertfordshire, Great Britain, Centre of the Universe
From a template, or from a view in a component or module for that matter, you could simply grab it from the URL params like so:

Code:
echo("Content ID: ".$_GET['id']);


Kris...

_________________
Joomla CMS Developer: http://www.kharmer.co.uk


Top
 Profile  
 
PostPosted: Tue Mar 17, 2009 1:14 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Thu Feb 05, 2009 5:11 pm
Posts: 5
That works sometimes however on some articles I get
"46:whats-new-in-15"
instead of just the article ID number
"46"
or sometimes I don't get an output at all.

I'm looking to just get the id number from the page so I could query the db with it. I will look into substring however not getting a response is not good. oh, just thought of it, if I browse to a section of category page it wouldn't have an article ID. So how could I pull the section id, category ID, and article ID?


Top
 Profile  
 
PostPosted: Tue Mar 17, 2009 1:57 pm 
User avatar
Joomla! Explorer
Joomla! Explorer

Joined: Thu Apr 24, 2008 1:58 pm
Posts: 253
You should use
$id=JRequest::getVar('id',0);


Top
 Profile  
 
PostPosted: Tue Mar 17, 2009 2:21 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Thu Feb 05, 2009 5:11 pm
Posts: 5
Thanks guys!

That seems to give me the same result as the earlier post. However, I can make it work with using a substring function.

Would anyone happen to know how to display the category id of a page?
I would like to use the category listing page.


Top
 Profile  
 
PostPosted: Thu Mar 19, 2009 1:13 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Fri Jun 02, 2006 12:37 pm
Posts: 21
Code:
$categoryid = JRequest::getVar( 'category' )

edit: Never mind, I didn't read carefully.

_________________
Menolo


Top
 Profile  
 
PostPosted: Fri Mar 20, 2009 1:31 am 
Joomla! Enthusiast
Joomla! Enthusiast

Joined: Wed Feb 11, 2009 3:32 am
Posts: 237
Location: Malaysia
Hi,

To do so you can check your database, under jos_content table. There are 3 field that you might need to retrieve which are:
1. SectionID
2. CatID
3. ParentID

Get the information accordingly and display it.

The first problem that you face might cause by table joining issue. If the data that you retrieve is more then one table, please name the fields accordingly to get the correct id. :)

Hope this helps you.

Regards,
YB

_________________
Regards,
YB


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 



Who is online

Users browsing this forum: No registered users and 18 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group