I am builidng a news area, and want to be able to send visitors to a specific news story loaded from a SQL database. Is it best to use a query string to access the news story data?
On a landing page, I have set up the links like this:
<xsl:attribute name = "href">/bcast/news/article.aspx?id=<xsl:value-of select = "id" />
With article.aspx?id=<xsl:value-of select="id" /> I am hoping to send visitors to a specific story by referring to the id of the story from the SQL database.
However, my article.aspx page must be missing something. Here is the code thus far:
<xsl:param name="currentPage"/>
<!-- SQL Here -->
<xsl:variable name = "newsStory" select="SQL:GetDataSet('DBname', 'select id, date, title, description, thumbnail, articletype from tableName', 'newsStory')"/>
<xsl:template match="/">
<h1><xsl:value-of select = "title" /></h1>
<p><xsl:value-of select = "date" /></p>
<div><xsl:value-of select = "description" /></div>
<xsl:value-of select="umbraco.library:RequestServerVariables('QUERY_STRING')"/>
</xsl:template>
The query string populates to the page using:
<xsl:value-of select="umbraco.library:RequestServerVariables('QUERY_STRING')"/>
But I must need to add something to:
<h1><xsl:value-of select = "title" /></h1>
<p><xsl:value-of select = "date" /></p>
<div><xsl:value-of select = "description" /></div>
Is there some sort of "by ID" property I can add that will fetch the data from the specific story? What needs to be added? Do I need parameters to point to the story by ID number?
This is a companion discussion topic for the original entry at https://our.umbraco.com/forum/22887-access-specific-sql-data-with-query-string