Layout design problem

Discussion in 'C#' started by SenTnel, Apr 29, 2009.

  1. #1
    We use an .ASP article publishing software and works very good, but has some limitations that we would like to get around it. This is the problem: The script publishes the article's image, headline abd summary alltogether, no space in between, there's no control as far as padding between the image and the text, etc., to find a workaround we substituted the following line in the original script:

    articlelist=articlelist &thisimage&"<b>"&rs("headline")&"</b>" & closetag & "</font>"

    for this:

    table_new="<table width='100%"&"' border='0"&"' cellspacing='5"&"' cellpadding='0"&"'><tr><td>&thisimage&</td><td><b>&rs("headline")&</b></td></tr></table>"
    articlelist=articlelist &table_new & closetag & "</font>"

    to try to split the output in a table, so we can beside other things like applying css styles, control de output's looks, but there's something here that is not working, while it does the job of displaying the news the way we want the link doesn't work, I mean, you can see the link, it takes the css a: link property, when you hover over the text the color changes, but the cursor never changes to a hand, and when you click on it nothing happens, by looking at it, can you tell what's wrong with our "workaround"?

    Thanks !


    P.D.: Below I´ll include the original .asp in case you need more to look at, the lines we are refering to starts at 155

    sample.asp:



    
    <!-- #include file="configdata.asp" -->
    <!-- #include file="databasedata.asp" -->
    <!-- #include file="incGetThumbnail.asp" -->
    <!-- #include file="incCache.asp" -->
    <%
    response.buffer=true
    response.flush
    zoneid=request("z")
    if instr(zoneid,"$")<>0 or zoneid="" then response.end
    nocache=request("nocache")
    fdate=request("fdate")
    if fdate<>"" then zonecache=""
    
    '/// Check Protection ///
    callingurl=lcase(Request.ServerVariables("HTTP_REFERER"))
    if zoneprotection<>"any" and instr(callingurl,lcase(applicationurl))=0 and callingurl<>"" then
    	specialurls=split(lcase(specialurls),";")
    	for x=0 to ubound(specialurls)
    		if len(specialurls(x))>5 then
    			if instr(specialurls(x),"http://")=0 then specialurls(x)="http://"&specialurls(x)
    			if instr(callingurl,specialurls(x))=1 then 
    				takeaction=true
    				exit for
    			end if
    		end if
    	next
    	if zoneprotection="restricted" and takeaction=false then response.end
    	if zoneprotection="banned" and takeaction=true then response.end
    end if
    
    '/// Zone Cache  ///
    if zonecache<>"" then
    	dim resultfile
    	resultfile=""
    	call getcache("zone",nocache)
    end if
    
    '//// Override Default Parameters 
    articlespz=request("h")			'Number of headlines 0-Unlimited
    showsummary=request("ss")		'Show Summary Y,N
    showsource=request("sc")		'Show Source Y,N
    showdates=request("sd")			'Show Dates Y,N
    showtn=request("st")			'Show Thumbnail Y,N
    displayhoriz=request("d")		'Display V-Vertical, H-Horizontal
    textalign=request("al")			'Align
    cellcolor=request("cc")			'Cell Color
    targetframe=request("target")	'Targetframe
    zonefont=request("font")		'Font
    fontcolor=request("color")		'Font Color
    fontsize=request("size")		'Font Size
    isarchive=request("isarchive")	'List only Archives
    stdate=request("stdate")		'With Start Date Like
    edate=request("edate")			'With End Date Like
    pdate=request("pdate")			'With Posted Date Like
    hdate=request("hdate")			'With Headline Date Like
    sort=request("sort")			'Sorting Criteria
    ord=request("ord")				'Order (asc,desc)
    
    
    today=year(now)&"/"&right("0"&month(now),2)&"/"&right("0"&day(now),2)
    if fdate<>"" then today=fdate
    
    psql="select * from vArticlesZones where "
    if isnumeric(zoneid) then 
    	psql=psql & "zoneid="&zoneid
    else
    	psql=psql & "zonename='"&zoneid&"'"
    end if
    
    if isarchive="" or isarchive="n" then psql=psql &" and status=1 " else psql=psql & "and status=4"
    
    if stdate="" and edate="" and pdate="" and hdate="" then
    	psql=psql & " and startdate<='"&today&"' and (enddate>='"&today&"' or enddate='-')"
    else
    	if stdate<>"" then psql=psql & " and startdate like '"&stdate&"%'"
    	if edate<>"" then psql=psql & " and enddate like '"&edate&"%'"
    	if pdate<>"" then psql=psql & " and posted like '"&pdate&"%'"
    	if hdate<>"" then psql=psql & " and headlinedate like '"& hdate & "%'"
    end if
    
    if sort<>"" then psql=psql & "order by "&sort else psql=psql & " order by startdate  "
    if ord<>"" then psql=psql & " " & ord
    
    set conn=server.createobject("ADODB.Connection")
    conn.open connection
    set rs=conn.execute(psql)
    if rs.eof then 
    	if nonewsmessage<>"" then articlelist="<div align=center><br>"&nonewsmessage&"<br>&nbsp;</div>" else articlelist=""
    else
    	'/// Headlines Per Zone
    	if articlespz<>"" then
    		articlespz=cint(articlespz)
    	else
    		articlespz=rs("articlespz")
    	end if
    	
    	'/// Display Summary
    	if showsummary="" then
    		showsummary=rs("showsummary")
    	elseif showsummary="n" then
    		showsummary=""
    	end if
    	
    	'/// Display Source
    	if showsource="" then
    		showsource=rs("showsource")
    	elseif showsource="n" then
    		showsource=""
    	end if
    	
    	'/// Display Dates
    	if showdates="" then
    		showdates=rs("showdates")
    	elseif showdates="n" then
    		showdates=""
    	end if
    	
    	'/// Display Thumbnail
    	if showtn="" then
    		showtn=rs("showtn")
    	elseif showtn="n" then
    		showtn=""
    	end if
    	
    	'/// Display Articles Horizontally
    	if displayhoriz="" then
    		displayhoriz=rs("displayhoriz")
    	elseif displayhoriz="v" then
    		displayhoriz=""
    	end if
    	
    	if zonefont="" then zonefont=rs("zonefont")
    	if fontsize="" then fontsize=rs("fontsize")
    	if fontcolor="" then fontcolor=rs("fontcolor")
    	if fontcolor<>"" then fontcolor=" fontcolor='"&fontcolor&"'"
    	if targetframe="" then targetframe=rs("targetframe")
    	if targetframe<>"" then target=" target='"&targetframe&"'" else target=""
    	if textalign="" then textalign=rs("textalign")
    	if cellcolor="" then cellcolor=rs("cellcolor")
    	if cellcolor<>"" then cellcolor=" bgcolor='"&cellcolor&"'"
    	
    	do until rs.eof
    		closetag=""
    		summary=rs("summary")&""
    		sumary=server.htmlencode(summary)
    		if rs("articleurl")<>"" and openexternal<>"" then thistarget="target=_blank"  else thistarget=target
    		c=c+1
    		if rowmade="" or displayhoriz="" then articlelist=articlelist & "<tr>"
    		if displayhoriz<>"" then rowmade="1"
    		articlelist=articlelist & "<td align='"&textalign&"' width=[WIDTH] left valign=top "&cellcolor&">"
    		if showtn<>"" then thisimage=gettnimage(rs("articleid"),textalign) else thisimage=""
    		articlelist=articlelist & "<font face='"&zonefont&"' size='"&fontsize&"'"&fontcolor&">"
    		if rs("article")<>"" or rs("articleurl")<>"" then articlelist=articlelist & "<a href='"&applicationurl&"anmviewer.asp?a="&rs("articleid")&"&z="&zoneid&"'"&thistarget&">" : closetag="</a>"
    
    		articlelist=articlelist &thisimage&"<b>"&rs("headline")&"</b>" & closetag & "</font>"
    
    		if showdates<>"" and rs("headlinedate")<>"" then articlelist=articlelist & "<br><font face='"&zonefont&"' size='"&fontsize&"'"&fontcolor&"><i>"&rs("headlinedate")&"</i></font>"
    		if showsource<>"" and rs("source")<>"" then articlelist=articlelist & "<br><font face='"&zonefont&"' size='"&fontsize&"'"&fontcolor&"><i>"&rs("source")&"</i></font>"
    		if showsummary<>"" and summary<>"" then articlelist=articlelist & "<br><font face='"&zonefont&"' size='"&fontsize&"'"&fontcolor&">"&replace(summary,vbcrlf,"<br>")&"</font>"
    		if readmore<>"" then articlelist=articlelist &"<br><font face='"&zonefont&"' size='"&fontsize&"'"&fontcolor&">"
    		if closetag<>"" then articlelist=articlelist & "<a href='"&applicationurl&"anmviewer.asp?a="&rs("articleid")&"&z="&zoneid&"'"&thistarget&">"&readmore&"</a>"
    		articlelist=articlelist &"</font>"
    		articlelist=articlelist&"</td>"
    		if displayhoriz="" then articlelist=articlelist & "</tr>"
    		rs.movenext
    				
    		'/// Display Limited Articles ?
    		if articlespz>0 and c>=articlespz then exit do
    	loop
    
    	'/// Get Appropiate Cell Width
    	width="100%"
    	if displayhoriz<>"" then 
    		if c=0 then c=1
    		articlelist=articlelist & "</tr>"
    		width=int(100/c)&"%"
    	end if
    	articlelist=replace(articlelist,"[WIDTH]",width)
    
    	articlelist="<table width=100% cellspacing=1 cellpadding=3 border=0>"&articlelist&"</table>" 
    end if
    rs.close
    set rs=nothing
    conn.close
    set conn=nothing
    
    articlelist=replace(articlelist,"\","\\")
    articlelist=replace(articlelist,"/","\/")
    articlelist=replace(articlelist,vbclrf,"\n")
    articlelist=replace(articlelist,chr(34),"\"&chr(34))
    articlelist=replace(articlelist,"'","\'")
    articlelist="document.write('"&articlelist&"');"
    
    '/// Do Cache ? ///
    if zonecache<>"" and resultfile<>"" then call writecache(resultfile,articlelist)
    
    response.write articlelist
    response.end
    %>
    
    Code (markup):
     
    SenTnel, Apr 29, 2009 IP
  2. camjohnson95

    camjohnson95 Active Member

    Messages:
    737
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    60
    #2
    try this:

    
    table_new = "<table width='100%' border='0' cellspacing='5' cellpadding='0'><tr><td>" & thisimage & "</td><td><b>" & rs("headline") & "</b></td></tr></table>"
    articlelist=articlelist & table_new & closetag & "</font>"
    
    Code (markup):
     
    camjohnson95, Apr 30, 2009 IP