Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2011-09-28 17:02:58

caruso_g
Member
From: Catania
Registered: 2009-04-11
Posts: 88
Website

How to access article's UID

Hi, I need to access article’s UID value in my code. Is there a tag or a function to retrieve it?

Thank you all,
Giuseppe

Offline

#2 2011-09-28 17:27:07

caruso_g
Member
From: Catania
Registered: 2009-04-11
Posts: 88
Website

Re: How to access article's UID

Is ied_doArticle still available somewhere?

Offline

#3 2011-09-28 17:40:08

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: How to access article's UID

There is txp:article_id.


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#4 2011-09-28 19:53:49

caruso_g
Member
From: Catania
Registered: 2009-04-11
Posts: 88
Website

Re: How to access article's UID

Hi Julián, thanks for you reply.
I know txp:article_id but I just need UID. About it, I saw you got the plugin then when published. Could be you still have a copy of it?

The need is bind to this topic subject.
Practically we created stored proc to copy articles created in production to testing.
The issue is that we are using Disqus for comments, and it has been set to use article’s id to identify the article but that is no more possible since the trigger function, while copying articles to testing, could encounter an id set to something else in testing (a new form, and image, a files etc.) created before the article in production, so, it would create issues with Disquss. By using UID we would be able to solve the issue.

Offline

#5 2011-09-28 20:17:19

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: How to access article's UID

Good old smd_query :)

<txp:smd_query query="SELECT uid FROM textpattern WHERE id = '?id'">
   {uid}
</txp:smd_query>

Offline

#6 2011-09-28 20:50:54

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: How to access article's UID

Oh, well, this is the very first time I see that uid column. Totally missed it before. Wonder what could it be useful for, beside the use case described by caruso_g .

Edit: to answer my own question, here is a current use of uid.

Last edited by maniqui (2011-09-28 20:52:23)


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#7 2011-09-28 21:12:54

caruso_g
Member
From: Catania
Registered: 2009-04-11
Posts: 88
Website

Re: How to access article's UID

Els, you’re great, thanks a lot. :)
Stef plugins are wonderful, but this one is really awesome!
It worked like a charm, thanks again.

@maniqui
Sadly, TXP –like lot of CMS out there– put everything in one table (could be for performances?) and that creates a lot of issues in some complex settings. It means that article’s id are actually no reliable to uniquely identify an article (well, actually neither uid are set as unique, even if they are a random md5 hash) above all in a classic testing/staging/production environment where you make edits in testing and add other content in production. UID comes to the rescue in similar cases, such as RSS feeds, or, e.g. if you use articles as product in an e-commerce set up you could use UID as a real unique identifier etc.

Giuseppe

Edit:
Added link to TXP db schema reference

Last edited by caruso_g (2011-09-28 21:20:12)

Offline

Board footer

Powered by FluxBB