Results 1 to 10 of 24

Thread: PHP script problem

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Junior Member
    Join Date
    Jul 2011
    Posts
    14

    Default PHP script problem

    I am trying to insert a php script into a master border. I added a layout reigon to the master border so I could add a background image to the master broder. I then added a text box in the layout region so I could add the script. I hit CTRL-T in the text box to add the script. If you go to http://www.sierravistarealestateaz.c.../themcnabs.php you can see how it is not positioned where I placed it, it is much lower on the screen. Here is a snap shot of how I added the script. Any idea how to fix this?


  2. #2
    Senior Member Thomas Frei-Herrmann's Avatar
    Join Date
    Apr 2010
    Location
    Berlin, Germany
    Posts
    1,000

    Default

    Hi,

    http://www.sierravistarealestateaz.c...remax-form.php

    well - it all looks like it is configurated. If you want this script to be centered in your layout-region you must extend the text box to the length of the layout region and center the text, so that your script will be included centered (the "T" will be in the center of the text box).

    In addition to that you might like to change the CSS style of that script to fit your own CSS better.

    I cant help any further, because I am about to leave for a business trip ...


    Code:
    <style type="text/css">
      .simpleSearchReMax {
        height: 95px;
        margin: 35px 0 0 109px;
      }
      .simpleSearchReMax select,
      .simpleSearchReMax input {
        font-size: 11px;
        padding: 2px 2px;
      }
      .simpleSearchReMax th,
      .simpleSearchReMax td {
        text-align: left;
        font-size: 11px;
        padding: 3px 15px 0 0;
        /* font-family: Verdana,Tahoma,Arial,Helvetica,Sans-serif; */
        color: #000000;
        font-weight: normal;
      }
      #simpleSearchReMaxRow1 {
        margin-bottom: 5px;
      }
       
      #propertyType { padding-right: 60px; }
      #propertyType select { width: 150px; }
      #city { padding-right: 60px; }
      #city select { width: 150px; }
       
      #priceMin { padding-right: 35px; }
      #priceMin input { width: 120px; }
      #priceMax { padding-right: 35px; }
      #priceMax input { width: 120px; }
      #bedrooms { padding-right: 35px; }
      #bedrooms select { width: 70px; }
      #bathrooms select { width: 70px; }
       
      #submitButton button {
        background: transparent url('/search/search.jpg') no-repeat scroll left top;
        border-width: 0px;
        cursor: pointer;
        display: block;
        height: 40px;
        width: 132px;
        text-indent: -9999px;
        text-align: left;
        position: relative;
        top: 10px;
      }
      #submitButton button:hover {
        background-position: 0 -40px;
      }
       
      </style>
    Tommy

    Administrator at the German NOF-Forum

    NOF-Tutorials.com | German NOF-Forum | Overview of my tutorials | Facebook

  3. #3
    Junior Member
    Join Date
    Jul 2011
    Posts
    14

    Default

    I am not interested in centering it. I simply want it to be where I put it. As you can see I put the script at the top of the layout reigon and it ended up at the bottom, actually it extended past the bottom of the region. It is like it is padding the top of the script with spaces.

    Here is a copy of the script.

    <?php
    require_once dirname(__FILE__)."/search.inc.php";
    ?>
    <style type="text/css">
    .simpleSearchReMax {
    height: 95px;
    margin: 35px 0 0 109px;
    }
    .simpleSearchReMax select,
    .simpleSearchReMax input {
    font-size: 11px;
    padding: 2px 2px;
    }
    .simpleSearchReMax th,
    .simpleSearchReMax td {
    text-align: left;
    font-size: 11px;
    padding: 3px 15px 0 0;
    /* font-family: Verdana,Tahoma,Arial,Helvetica,Sans-serif; */
    color: #000000;
    font-weight: normal;
    }
    #simpleSearchReMaxRow1 {
    margin-bottom: 5px;
    }

    #propertyType { padding-right: 60px; }
    #propertyType select { width: 150px; }
    #city { padding-right: 60px; }
    #city select { width: 150px; }

    #priceMin { padding-right: 35px; }
    #priceMin input { width: 120px; }
    #priceMax { padding-right: 35px; }
    #priceMax input { width: 120px; }
    #bedrooms { padding-right: 35px; }
    #bedrooms select { width: 70px; }
    #bathrooms select { width: 70px; }

    #submitButton button {
    background: transparent url('/search/search.jpg') no-repeat scroll left top;
    border-width: 0px;
    cursor: pointer;
    display: block;
    height: 40px;
    width: 132px;
    text-indent: -9999px;
    text-align: left;
    position: relative;
    top: 10px;
    }
    #submitButton button:hover {
    background-position: 0 -40px;
    }

    </style>
    <script language="JavaScript" type="text/javascript">
    function disableInactive(propertyType) {
    switch (propertyType) {
    case 'residential':
    disableItem(new Array());
    break;
    case 'land':
    disableItem(new Array('sqFootMin', 'sqFootMax','beds','baths'));
    break;
    case 'commercial':
    disableItem(new Array('sqFootMin', 'sqFootMax','beds','baths'));
    break;
    case 'multi_family':
    disableItem(new Array('parcelSizeMin','parcelSizeMax','beds','bath s'));
    break;
    case 'farm_ranch':
    disableItem(new Array('sqFootMin', 'sqFootMax','parcelSizeMin','parcelSizeMax','beds' ,'baths'));
    break;
    case 'rental_residential':
    disableItem(new Array('parcelSizeMin','parcelSizeMax'));
    break;
    }
    }

    function disableItem(items) {
    with (document.simpleSearchForm) {
    for (i=0; i<elements.length; i++) {
    if (in_array(elements[i].name, items))
    elements[i].disabled = true;
    else
    elements[i].disabled = false;
    }
    }
    }

    function in_array(needle, haystack) {
    for (ii=0; ii<haystack.length; ii++) {
    if (haystack[ii] == needle)
    return true;
    }
    return false;
    }
    </script>

    <form action="/search/index.php" name="simpleSearchForm" class="simpleSearchReMax">

    <table id="simpleSearchReMaxRow1">
    <tr>
    <th>Property Type</th>
    <th>City</th>
    <td rowspan=2 id="submitButton">
    <button type="submit" name="submit">Search MLS</button>
    </td>
    </tr>

    <tr>
    <td id="propertyType">
    <select name="type" onChange="disableInactive(this.options[this.selectedIndex].value);">
    <option value="residential">Residential</option>
    <option value="land">Land</option>
    <option value="commercial">Commercial</option>
    <option value="multi_family">Multi-Family</option>
    <option value="farm_ranch">Farm and ranch</option>
    <option value="rental_residential">Rentals</option>
    </select>
    </td>

    <td id="city"><select name="city[]">
    <?php printCityOptions(); ?>
    </select></td>
    </tr>
    </table>

    <table id="simpleSearchReMaxRow2">
    <tr>
    <th>Minimum Price</th>
    <th>Maximum Price</th>
    <th>Bedrooms</th>
    <th>Bathrooms</th>
    </tr>

    <tr>
    <td id="priceMin"><input type="text" name="priceMin" value=""></td>
    <td id="priceMax"><input type="text" name="priceMax" value=""></td>

    <td id="bedrooms"><select name="beds">
    <?php printOptions(array('any', '1+','2+','3+','4+','5+','6+','7+')); ?>
    </select></td>

    <td id="bathrooms"><select name="baths">
    <?php printOptions(array('any', '1+','1.5+','2+','2.5+','3+','4+')); ?>
    </select></td>
    </tr>
    </table>

    </form>

  4. #4
    Senior Member Adendum's Avatar
    Join Date
    Apr 2010
    Location
    London (UK) & Granada (Spain)
    Posts
    926

    Default

    That often happens when you use a text box to paste code into. I've had similar issues with Google Search boxes, Google Maps and other similar bits of code.

    Usually the solution is to place a single cell table exactly where you want your code to appear and paste into that - same way as in a text box but you're using a table cell. 99% of the time that works. You might need to play around with pixel positioning and you may have some "conflict" with the Google Maps code you already have in the HEAD. If it doesn't work immediately see what happens if you eliminate the Google Maps code.
    Paul - Aditerum Ltd and AllSortsOfStuff Ltd
    NOF11 (in Admin mode!); Vista Premium 64bit; AMD Phenom IIx4 945 Processor 3.00Ghz; 8.0Gb RAM
    Wouldn't it be great if there was only a single browser to worry about!!!

  5. #5

    Default

    What I have ran into with text boxes an imbeded html is that the size of the text box matter, you have the titles for the search boxes on top of the search fields, if the text box is not tall enough to handle this then it will push everything down. Try enlarging your text box height and in the text box properties box click on lock height and try it.

    I don't know your php code and wether or not it generates the search field lables on the left or the top, so you maybe having width problems if the layout is on one line.

  6. #6
    Junior Member
    Join Date
    Jul 2011
    Posts
    14

    Default

    I figured it out. I changed the Paragraph from P to "" and that seems to have fixed the problem. Now for some reason the script displays on all pages except the home page. Any idea why?

    http://www.sierravistarealestateaz.com/index.php

Posting Permissions

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