Beth Hales wrote:

>I have placed the code that relates to pulling in the content to be displayed 
>on the page below.  As you say Stephen, it only has to do with the "links" 
>pages, and I haven't changed the code within the links pages since the site 
>was first uploaded.  The links page is just a basic query that grabs the info 
>from the database and displays it on a page.
>  
>
There's a few things to note...

<cfif #page# is not 'links'>
You don't need the #'s around the variable page in cfifs and any reference to a 
variable should also use the variables scope, in this case it should be url.page


<cfquery name="side" datasource="kdc.wa.gov.au">
select * from pages where '#page#'= url 
</cfquery>

I don't suppose it matters much which way around it goes, but url = '#page#' is 
more readable.  However, you definately should be using cfqueryparam on this 
query. eg. url = <cfqueryparam cfsqltype="cf_sql_varchar" value="#url.page#"> 
to help protect from SQL injection via the url.

You should also try to make sure that you don't include processing like 
cfqueries in your displays.  Seperating them out makes them easier to find, 
easier to reuse and easier to change when you need to.

In the first part of your cfif you have improperly nested cf and html.  This is 
probably down to the layout of the page in terms of table rows, cells etc, but 
I always like to make sure that I have CFIFs and outputs around either complete 
tables, rows or cells.  What you in the code is no table start, no row start, 
then a bunch of cells, the end of the row and the end of the table. This is 
possibly part of the problem with the display of the links pages.  

Looking at the cfif you have the 3 footer tables repeated in both the if and 
the else section.  You can pull this out to below the cfif and will work 
exactly the same, but without the duplication of code, making future amendments 
to the footer much easier and the cfif easier to read.

Once you pull the footer out of the cfif, you can immediately see a difference 
between the display of content for non link pages and link pages. The content 
for non-link pages is included between td's, but the link pages are not.  Also, 
the non-link pages have an end tr and an end table after the display of the 
content.  The link pages do not.

Take the end tr and the end table out of the non-link part of the code and put 
it after the cfif means that the links pages will also have an end tr and table.

Last but not least wrapping the cfinclude for the links page in <td> will 
ensure that the links are in a cell within the table.

As a final thought, I think you can actually do away with that <cfif url.page 
is not 'links'> completely.  The links pages don't have a sidebar, so make sure 
that sidebar is set to 0 in the database for the links record in the pages 
table and you will only need the code that is in the top half of the cfif.

This is what you end up with..... 
(I've included a <table><tr> at the top just for completeness - you'll need to 
remove them)

<table>
  <tr>
    <!--spacer!-->
    <cfquery name="side" datasource="kdc.wa.gov.au">
    select * from pages where url =
    <cfqueryparam cfsqltype="cf_sql_varchar" value="#url.page#">
    </cfquery>
    <cfoutput query="side">
      <cfif side.sidebar is 0>
        <td><!--content!-->
          <cfinclude template="content/#url.page#.cfm"></td>
        <cfelse>
        <td width=416><!--content!-->
          <cfinclude template="content/#url.page#.cfm"></td>
        <td><img alt="" border=0 height=1 hspace=0 src="images/trans1x1.gif" 
width=1></td>
        <td background="images/dots_vert.gif" width=1 ><img alt="" border=0 
height=1 hspace=0 src="images/trans1x1.gif" width=1></td>
        <td><img alt="" border=0 height=1 hspace=0 src="images/trans1x1.gif" 
width=10></td>
        <td><br>
          <cfinclude template="add/#side.sidebar#.cfm"></td>
      </cfif>
    </cfoutput> 
  </tr>
</table>
<table width="774" border="0" cellspacing="0" cellpadding="0" summary="page 
layout table">
  <tr bgcolor=white>
    <td class=t width="60%" align=right><br>
      <img src="images/arrow_left.gif"  border=0 alt="">&nbsp;<a class=link3 
href="javascript:history.go(-1)">Back</a> |&nbsp; </td>
    <td class=t ><br>
      <a class=link3 href="#top">Top</a>&nbsp;<img src="images/arrow_up.gif"  
border=0 alt=""></td>
  </tr>
</table>
<table width="774" border="0" cellspacing="0" cellpadding="0" bgcolor=white 
summary="page layout table">
  <tr>
    <td bgcolor=white><img src="images/trans1x1.gif" height=15 border=0 
alt=""></td>
  </tr>
</table>
<table width="774" border="0" cellspacing="0" cellpadding="0" summary="page 
layout table">
  <tr bgcolor=666666>
    <td class=tp><cfoutput query="side"> Page Last Verified 
#DateFormat('#created#','mmmm 
        d yyyy')#</cfoutput></td>
    <td ><img src="images/trans1x1.gif" width=110 height=1 border=0 alt=""></td>
    <td  ><a class=menutop href="index.cfm?menu=196&page=copyright">Copyright : 
</a></td>
    <td  ><a class=menutop href="index.cfm?menu=197&page=disclaimer">Disclaimer 
: </a></td>
    <td  ><a class=menutop href="index.cfm?menu=198&page=privacy">Privacy 
Statement : </a></td>
    <td ><a class=menutop href="http://www.wa.gov.au";>Government of Western 
Australia</a></td>
  </tr>
</table>


With all the changes, you should be able to replace the code you send through 
with the code above (minus the table and tr at the top) and your links will go 
into the content area.

I hope you find this HUGE email useful. ;)

Regards

Stephen





~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Find out how CFTicket can increase your company's customer support 
efficiency by 100%
http://www.houseoffusion.com/banners/view.cfm?bannerid=49

Message: http://www.houseoffusion.com/lists.cfm/link=i:15:1182
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/15
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:15
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.15
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to