get page url from content item id

Hi all

if i get the users to provide a content item id, is it possible to determine the page url from this. also if i do this, will rhythmx transform the url i put in the code into a proper site url when publishing?

thanks
michelle

i found this suggestion from a previous post, but this idea involves knowing the content type, revision and all other parameters of the content item - doesn’t it?

thanks
michelle

<xsl:variable name="something" select="document(DATA_URL)"/>

replace "something" with whatever you like, and DATA_URL with the url to fetch your data... usually, you can construct this by pasting in a preview url and replacing the contentid in that url with the one from your current field.

would be grateful if anyone has any suggestions for this.

thanks
michelle

Hi Michelle

In the past I’ve created a shared template “S - Published URL” where the context and authtype variables are hardcoded as 1 (or whatever you use) in the sys_casGeneratePubLocation (attached).

Just use the value of the pub location as normal in the xsl template:

<span psxedit="Publication_URL" psxshow="psx-Publication_URL" />

Cheers
James

Hi jimbo

i don’t really understand this.

i have a rssItem content type. one of the fields is “link” - the users can either type in a url (leads to an external site), leave it blank (news item is standalone, doesn’t lead anywhere when clicked) or provide a contentID of another piece of content (a web page generated by RX).

using sys_casGeneratePubLocation i need to know the variantID of the content item whose id is provided don’t I? This could be anything depending on the piece of content the user has selected.

so given a contentID of say 1234, I need to populate the <link> tag for this RSS item with a url which will transform into a published web page when the RSSFeed xml document is published.

I tried what you said in my rssItem cas - but obviously misunderstood what i was trying to do as i put in the variant ID of my rssItem and therefore got its publication location url in my RSSFeed document.

thanks
michelle

Hi Michelle

Do the content items you want to display the link to contain the default variantid?

You will need to create a new resource in the rss_cas which takes the content id and generate the link based on the id and the shared field default_variantid. The reason for doing this is that a link relies on more than just contentid and variantid ie the revisionid. If you use the same resource as the page then you will get the revisionid of page and not the rss item.

Then in your template use an xsl choose statement for all your possible outcomes.

Cheers
James

thanks jimbo

i think i might try a different route. i’m thinking of providing a slot where the users can assemble another page or an external link and i will extract the url if there is something in the slot.

regards
michelle

ok i still need help with this please.

i have supplied users with a slot where they can either insert an external link or an article. from this i extract the link. the external link works fine as this needs no transformation.

however, with the rx page, when i preview my rssItem i get a value something like

http://chs85ecm.dover.poits.net:9992/Rhythmyx/PO_article_cas/page_assembler.html?sys_revision=45&sys_siteid=309&sys_authtype=0&sys_contentid=1572&sys_variantid=510&sys_command=&sys_folderid=&sys_context=0

which is good and what i was expecting. however when i change the url in the browser to context=0 and authType=0 - the url is transformed to /GB/offers/offers - again good as this is what happens when i preview other pages in the site.

however, it seems that the other pages in the site are further transformed during the publishing routine so the actual url will become content/pages/template/offers_offers.htm.

this further transformation does not happen with the urls in my rssItem.

does anybody know how i can make this happen.

or does anybody have any better ideas to achieve what i am trying to do - basically wrap a url to a piece of rx content in a <link> tag in my rss.xml.

thanks
michelle

i’m guessing that rx does not do the transform on publish as my url is just contained in a link tag and not the href attribute of an anchor tag.

i could transform this before publish as the rules for our url names are always the same - but i’m not sure how or where to do this. can anybody help please. is there an post exit i can use to transform the value of this tag.

thanks
michelle