goshen
VP-CART New User
132 Posts |
Posted - February 25 2007 : 22:16:05
|
I am trying to split the display of the content on the home page and the random product table. I wish to place the dynamic welcome message in a div and then the random product(featured products) in a table below it.
here is the current code: <% '********************************************************************************** ' Version 6+ Content management ' shopcontent.asp?type=news ' shopcontent.asp?type=news&template=xxx ' Allows you to add content using the content table ' VP-ASP 6.50 June 28, 2004 '********************************************************************************* Dim CatalogId, dbtable, idfield, contentdbc, dbc, crs, contentid Dim messagetype Dim template 'VP-ASP 6.08a - moved down below generate meta tags 'shoppageheader setSess "CurrentURL","default.asp" messagetype="home" 'contentid = request("contentid") if contentid > "" then if NOT isnumeric(contentid) then HandleError "Content ID must be a numeric value" end if end if if messagetype="" and contentid = "" then HandleError getlang("LangRecordNotFound") end if shopopendatabase contentdbc WriteImpressions 'VP-ASP 6.08a - Generate Dynamic Meta tags setupdynamiccontent contentdbc, contentid, messagetype InitializeSystem
shoppageheader
generatecontentsql sql 'debugwrite sql OpenRecordSet contentdbc, crs, sql If crs.eof then handleerror getlang("LangRecordNotFound") & " " & messagetype else if crs("loggedin") <> true then Formatcontent crs else if Getsess ("login") > "" then Formatcontent crs else shopwriteerror getlang("langcustadminloginrequired") end if end if end if closerecordset crs shopclosedatabase contentdbc
shoppagetrailer '**************************************************** ' write a message '*************************************************** sub handleError (msg) shopwriteError msg end sub ' '*************************************************************** ' Use temaplte or just displaye it '************************************************************** Sub Formatcontent (crs) dim message, message2, image 'message=crs("message") if contentid = "" then dim getcontentsql, getcontentrs getcontentsql = "select contentid from content WHERE messagetype = '" & messagetype & "'" OpenRecordSet contentdbc, getcontentrs, getcontentsql
if getcontentrs.eof then shoperrror "There has been an error retrieving the ID for this content." else contentid = getcontentrs("contentid") end if
closerecordset getcontentrs end if message=translatelanguage(contentdbc, "content", "message","contentid", contentid, crs("message")) 'message2=crs("message2") message2=translatelanguage(contentdbc, "content", "message2","contentid", contentid, crs("message2")) contentid=crs("contentid") image=crs("contentimage") If isnull(image) then image=""
' this is where the dynamic content and the random content are joined together
Gettemplate crs, template if template<>"" then ShopMergetemplate "content", template, contentid, "contentid" If serror<>"" then handleError serror end if exit sub end if If image<>"" then Formatimage image end if response.write message & "<br /><br />" response.write message2 end sub
Sub GetTemplate (crs, template) dim dbtemplate, suffix template=gettextfield("template") dbtemplate=crs("template") If template="" then if not isnull(dbtemplate) then template=dbtemplate end if end if if template="" then exit sub suffix=right(template,3) if lcase(suffix)<>"htm" then template="" end if end sub
Sub formatimage (image) Response.write "<p class=""ac"">" response.write "<img border='0' src='" & image & "'>" response.write "</p>" end sub '************************************************************************ ' get last non hidden news or whatever '*********************************************************************** Sub GenerateContentsql (sql) if contentid > "" then sql="select * from content where contentid=" & contentid else sql="select * from content where messagetype='" & messagetype & "'" end if sql=sql & " and hide=0 " If getconfig("xselectproductsbylanguage")="Yes" and getsess("language")<>"" then sql=sql & " and (contentlanguage='" & getsess("language") & "'" sql=sql & " or contentlanguage is null)" end if sql=sql & " order by contentid desc" end sub
'VP-ASP 6.08 - Impressions weren't writing correctly. Sub WriteImpressions contentdbc.execute("UPDATE content SET impressions = 0 WHERE impressions IS NULL") if contentid <> "" then 'increment content impressions contentdbc.execute("UPDATE content SET impressions = impressions + 1 WHERE contentid = " & contentid) Else If messagetype <> "" Then contentdbc.execute("UPDATE content SET impressions = impressions + 1 WHERE messagetype LIKE '" & messagetype &"'") End If End If End Sub%> </div> |
|
devshb
Senior Member
United Kingdom
1904 Posts |
Posted - February 26 2007 : 00:56:22
|
Have a look at this, because I think it'll do what you want:
Content-Management Enhancements: http://www.bigyellowzone.com/shopexd.asp?id=125
That lets you show your dynamic content within existing pages/panels without having to have a "shopcontent.asp?type=blah" url for the page etc, and you can include multiple content within a single page (eg one dynamic bit in a side-panel, another at the top, and another at the bottom etc).
So, you could have your real home page still using "default.asp" and just change default.asp to call the byz show-content function inside that, and then call the random products under that call.
It also lets you create "static" asp files with proper names at the touch of a button (eg "aboutus.asp" that mimics what your "shopcontent.asp?type=aboutus" page would do (those pages still pick-up the content at load-time rather than at file-creation-time; it's only the filename that's "static")
Simon Barnaby Developer [email protected] www.BigYellowZone.com Web Design, Online Marketing and VPASP addons |
Edited by - devshb on February 26 2007 00:57:50 |
|
|