Getting Content State of Content Item in Velocity Template

Hi, I was wondering if there’s anyway I can get the contentstateid of a content item in a velocity template?

Thanks, George

Any ideas anyone on how I can see whether a content item in a slot is in an archive state?

Fixed this now by querying the contentstatus table and getting the contentstate for the content item in the slot.

Hi George,
I hope your still receiving replies to this thread, but we’re trying to do the same thing, could you post what you did exactly? How did you query the contentstatus table from your template?

Shane

Shane,

An example my might be:

  1. First get the content Id
#set($contentId = $rx.guid.getContentId($sys.item.guid))
  1. Set up a query with the contentId on the contentstatus table
#set($query = "select t.contentstateid from contentstatus t where t.contentid = $contentId"  )

  1. Query the DB
#set($results = $rx.db.get("rhythmyx", $query))

where “rhythmyx” can be substituted for the name of your repository db for your installation of Rhythmyx.

I hope this helps…

Thanks Ryan, I really appreciate that.

Shane

Step 3 should look like this:

#set($results = $rx.db.get("", $query))

The empty string tells the database module to use the current rhythmyx repository. This allows for slightly more portability between environments.

Rushing,

Thank you for correcting step 3. I totally forgot about that! :smiley:

I have always wondered why archived items show up in slots within a preview and was curious as to what you are doing with this solution? I am guessing you are shading/hiding archived content through preview css and triggered by the results of this query?