Get any mod current page id

Hi all

I want to call the current record ID of any mod to put into a block.  For example, record 3 would have the ID 3.  What MySql query would I use to echo the ID of that record.

TIA

Gareth

Quote · 27 Jan 2014

Could you explain more please what is "record ID of any mod"?

http://boonexpert.com
Quote · 27 Jan 2014

Thank for the reply

Lets just say I have a mod called products and I have a table called products_main which stores all the posts in the mod.

I want to create a block which will echo (write) the id of the post on display.

What php is needed so I can find the current `id` field and display that information on the block I have created.

TIA

Gareth

Quote · 27 Jan 2014

Sorry, it's not really clear what do you want to do.

Modules are using their own table structure, which is different from mod to mod. On one module db table you have "id" field named "ID", in another you have "id", in third you have "post_ID" or something, on some modules you don't have ID in db table at all. There is no "standard" code to "find" it. Also various modules are using various php code in order to display their content. You need to know if for every particular module.

If you'll make some graphic sketch as an example of what do you need to do, maybe we'll come up with some ideas. For now it's not clear why do you need to show a database record ID number somewhere.

http://boonexpert.com
Quote · 27 Jan 2014

I have attached an example of the record.  I want to echo on a separate block the id of the post.

 

Gareth

example.jpg · 124.7K · 191 views
Quote · 27 Jan 2014

In example2 there is a record with ID=3

I want to be able to call that ID and display the number 3 it in the box marked Select Product which can be seen in example.jpg on the right hand side.

TIA

Gareth

example.jpg · 124.7K · 197 views
example2.jpg · 36.3K · 179 views
Quote · 27 Jan 2014

Oh, that's what you need.. As I mentioned before, there's no single standard for the db table for all modules, so you have to look into the particular module code and its database for something like $productInfo -> ID and use it where you need.

http://boonexpert.com
Quote · 27 Jan 2014

 

I want to be able to call that ID and display the number 3 it in the box marked Select Product 

 What is exact module name?

http://boonexpert.com
Quote · 27 Jan 2014

if you based your module off of one of the other modules such as Groups, then there are already certain variables that you can use such as $aDataEntry['id'] or $aData['id'] or $iEntryId. It does depend on where you are using the variable so you may have to try each one and see which works.

Any other database field values can be called using the same structure. such as $aDataEntry['uri']

Hope this helps.

 

So you could try - in a php block:

echo $aDataEntry['id'];

or

echo $aData['id'];

or

echo $iEntryId;

caredesign.net
Quote · 27 Jan 2014

Hi All

 

Thanks for the help, I managed to work it out by using the following code:

 

$ID = (int)$this->aDataEntry['id'];

echo $ID

 

From this I was able to set up a click and collect feature on my site which texted businesses when someone wanted to order a product.

 

No118

Quote · 13 Feb 2014
 
 
Below is the legacy version of the Boonex site, maintained for Dolphin.Pro 7.x support.
The new Dolphin solution is powered by UNA Community Management System.