Page 1 of 3 123 LastLast
Results 1 to 10 of 24

Thread: PHP script problem

  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

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

    Default

    That'll be because of the way NOF publishes. Your home page is in the root folder and all other pages sit in a folder called HTML. So the script works in all pages in the HTML folder because it is pointing the the correct paths for the script files. In the home page it isn't, so you need to change the code on just the home page to find the script files.
    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!!!

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

    Default

    THis worked previously so I don't know if that is the problem. I call the script like this <?php include '../search/simple-search-remax-form.php';?>. I removed the .. infront of the URL and it still doesn't work on the home page.

  9. #9
    Charles Edmonds
    Guest

    Default Re: PHP script problem

    On Sat, 16 Jul 2011 17:00:02 +0000, themcnabs wrote:

    > THis worked previously so I don't know if that is the problem. I call
    > the script like this <?php include
    > '../search/simple-search-remax-form.php';?>. I removed the .. infront
    > of the URL and it still doesn't work on the home page.


    Assuming that your publishing with the default NOF structure, your site
    looks like this:

    Root folder ( home page ... aka index.html or index.htm or index.php )
    <html> (the folder where ALL other html and php files are generated)

    Then you have to adjust the path of your code so that it finds the folder
    where your php files are.

    Assuming that the <search> folder is off the root (same level as the <html>
    folder), then you can use these values:

    If you call the script from the home page, it would be:
    /search/simple-search-remax-form.php

    If you call the script from any page other than the home page, it would be:

    .../search/simple-search-remax-form.php


    With regards to the dots, here are the rules:

    No dots is an absolute path off the root folder. IOW:

    /search/simple-search-remax-form.php

    One dot means "look down" into a folder below the one where the page that
    calls it sits. In this case, the "search" folder sits below the level
    where it is called:

    ../search/simple-search-remax-form.php

    Either this or the first one should work on the home page if the search
    folder is below that level.


    Two dots means "up one level". So this script:

    .../search/simple-search-remax-form.php

    means look up one directory level, then down in a directory called "search"
    to find the script. That would be what you use for pages in the <html>
    folder (again assuming the <search> folder is off the root.


    If the <search> folder is down below the <html> folder, then the path for
    the home page would be:

    /html/search/simple-search-remax-form.php

    or

    .../html/search/simple-search-remax-form.php

    and the path for pages in the <html> folder would be:

    ../search/simple-search-remax-form.php


    Does that help?

    Charles





    --
    -------------------------------------------------------------------------------------------------------
    Charles Edmonds
    cjeByteMeSpammers@lansrad.com (remove the "ByteMeSpammers" to email me)
    www.clarionproseries.com - "Get ProPath, make your Clarion programs ready
    for Windows 7 and Vista!"
    www.ezchangelog.com - "Free ChangeLog software to manage your projects!"
    www.setupcast.com - "A revolutionary new publishing system for software
    developers - enhanced for SetupBuilder users!"
    www.pagesnip.com - "Print and Save the Web, just the way you want it!"
    www.clarionproseries.com - "Serious tools for Clarion Developers"
    www.ezround.com - "Round Corner HTML tables with matching Banners, Buttons
    and Forms - Now with PNG support!
    www.lansrad.com - "Intelligent Solutions for Universal Problems"
    www.fotokiss.com - "World's Best Auction Photo Editor"
    -------------------------------------------------------------------------------------------------------

  10. #10
    Senior Member RayC's Avatar
    Join Date
    Apr 2010
    Location
    Toronto-ish, Canada
    Posts
    1,732

    Default

    Hey, Charles, I'm seeing spots -- or dots in this case. I think you have one too many in your examples.
    Ray Cambpell
    Sounds In Sync
    Linked in

Posting Permissions

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