Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2003
    Posts
    225

    Unanswered: formatting of text froma a dynamic table in dreamweaver

    I am trying to slowly put together a very simple content management site for a footy club i run,

    the data is stored in a mysql database and lined to the web page using a dynamic table from within dreamweaver, it displays all the info except one thing it appears in one huge paragraph, take a look at my page

    Link is at:

    http://itdesignz.co.uk/Clients/RTFC/cms/home.php

    The Data in the mysql has the spaces and enters breaks in it, but these are not reflected in my page.

    I am really new to dreamweaver and am not sure how to overcome this problem,

    my page code is:

    Code:
    <?php require_once('Connections/rtfccms.php'); ?>
    <?php
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
    {
      $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;
    
      switch ($theType) {
        case "text":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;    
        case "long":
        case "int":
          $theValue = ($theValue != "") ? intval($theValue) : "NULL";
          break;
        case "double":
          $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
          break;
        case "date":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;
        case "defined":
          $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
          break;
      }
      return $theValue;
    }
    
    $editFormAction = $_SERVER['PHP_SELF'];
    if (isset($_SERVER['QUERY_STRING'])) {
      $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
    }
    
    if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
      $insertSQL = sprintf("INSERT INTO news (headline, story, `date`, active, archive) VALUES (%s, %s, %s, %s, %s)",
                           GetSQLValueString($_POST['headline'], "text"),
                           GetSQLValueString($_POST['story'], "text"),
                           GetSQLValueString($_POST['date'], "date"),
                           GetSQLValueString(isset($_POST['active']) ? "true" : "", "defined","1","0"),
                           GetSQLValueString(isset($_POST['archive']) ? "true" : "", "defined","1","0"));
    
      mysql_select_db($database_rtfccms, $rtfccms);
      $Result1 = mysql_query($insertSQL, $rtfccms) or die(mysql_error());
    
      $insertGoTo = "home.php";
      if (isset($_SERVER['QUERY_STRING'])) {
        $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
        $insertGoTo .= $_SERVER['QUERY_STRING'];
      }
      header(sprintf("Location: %s", $insertGoTo));
    }
    ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Untitled Document</title>
    <style type="text/css">
    <!--
    body {
        background-color: #FFFFFF;
    }
    .style2 {
        color: #006633;
        font-weight: bold;
        font-size: 18px;
    }
    .style3 {
        color: #006603;
        font-weight: bold;
        font-size: 24px;
    }
    -->
    </style></head>
    
    <body>
    <table width="935" height="325" border="1" align="center" bordercolor="#006700">
      <tr>
        <td height="93"><img src="images/top_image.jpg" width="974" height="89" longdesc="http://www.redtilefc.co.uk" /></td>
      </tr>
      <tr>
        <td height="34"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="100" height="22">
          <param name="movie" value="button1.swf" />
          <param name="quality" value="high" />
          <param name="bgcolor" value="#FFFFFF" />
          <embed src="button1.swf" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="100" height="22" bgcolor="#FFFFFF"></embed>
        </object>
          <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="100" height="22">
            <param name="movie" value="button2.swf" />
            <param name="quality" value="high" />
            <param name="bgcolor" value="#FFFFFF" />
            <embed src="button2.swf" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="100" height="22" bgcolor="#FFFFFF"></embed>
          </object></td>
      </tr>
      <tr>
        <td height="158"><p class="style3">Insert A New Story  
          <form method="post" name="form1" action="<?php echo $editFormAction; ?>">
            <table width="378" align="center">
              <tr valign="baseline">
                <td nowrap align="right">Headline:</td>
                <td><input type="text" name="headline" value="" size="70"></td>
              </tr>
              <tr valign="baseline">
                <td height="95" align="right" nowrap>Story:</td>
                <td><textarea name="story" cols="70" rows="15"></textarea></td>
              </tr>
              <tr valign="baseline">
                <td nowrap align="right">Active:</td>
                <td><input type="checkbox" name="active" value="" ></td>
              </tr>
              <tr valign="baseline">
                <td nowrap align="right">Archive:</td>
                <td><input type="checkbox" name="archive" value="" ></td>
              </tr>
              <tr valign="baseline">
                <td nowrap align="right">&nbsp;</td>
                <td><input type="submit" value="Insert record"></td>
              </tr>
            </table>
            <input type="hidden" name="MM_insert" value="form1">
          </form>
        <p>&nbsp;</p></td>
      </tr>
      <tr>
        <td height="28"><p align="center" class="style2">Site built and maintained By <a href="www.itdesignz.co.uk">IT Designz</a> </p>    </td>
      </tr>
    </table>
    </body>
    </html>
    Please help

    Andy

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    consider embedding the HTML tags (<P> & </p>, <BR> etc in the text stream

    and/or consider storing each paragraph as a element int he db, and add tags as required

    OR eregi to replace carriage return characters in the text stream in PHP into <B> or <P> tags.

    embedding the HTML tags is proabably the easiest to implement... its also the nastiest solution

    chainging your stoarge mechanism is probably the 'correct' (in an academic sense) solution


    HTH
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Mar 2003
    Posts
    225
    hmmm, i really am a novice at this sorry, could you elaborate on what you said,

    sorry for appearing dumb

  4. #4
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    in your page content that you are reading from the DB embed the HTML tags


    so you store your content in the db as:
    "<H3>Breaking news</h3><P>Chimp471 gets website to work using.... blah blah blah</p><p>He worked out how to do this using a technique learned from dbForums.... blah blah blah</p>He learned to start a new line using the BR tag<BR>Which solved his current problems"


    which could render in a web page something like:......
    Breaking news
    Chimp471 gets website to work using.... blah blah blah

    He worked out how to do this using a technique learned from dbForums.... blah blah blah

    He learned to start a new line using the BR tag
    Which solved his current problems

    bear in mind yoi are sendign a stream of data to the browser, it fdoens't care what it receives, and if it hits the <> pairing it knwos its a tag it uses to apply markup / formatting
    I'd rather be riding on the Tiger 800 or the Norton

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •