Results 1 to 4 of 4

Thread: pull city in style.php

  1. #1
    Join Date
    Jan 2005
    Posts
    21

    Default pull city in style.php

    Hello--

    I have an OR 1.1.4 site. On the style.php page, I would like to sandwich an if/else statement based on the city in the middle of the property features and the full description. Something like this:

    PHP Code:
    if ($city == "Anytown") {
         echo 
    "Find this property on an Anytown map.";
    }

    elseif (
    $city == "Gotham City") {
         echo 
    "Find this property on a Gotham City map.";

    etc...

    I am doing something similar in usertop.html:

    PHP Code:
        if ($city == "Anytown") { 
            echo 
    "<img src='../images/layout/nav/nav-on-anytown.gif' width='114' height='19' border='0' name='anytown'>";
            }
        else {
            echo 
    "<img src='../images/layout/nav/nav-othertown.gif' width='114' height='19' border='0' name='othertown'>";
            } 
    However, $city doesn't generate any output in listingview.php.

    I tried cloning the renderSingleListingItem function:

    PHP Code:
        function renderCity($listingID$name) {
            global 
    $conn$config;
            
    $listingID make_db_extra_safe($listingID);
            
    $name make_db_extra_safe($name);
            
    $sql "SELECT " $config[table_prefix] . "listingsDBElements.field_value FROM " $config[table_prefix] . "listingsDBElements, " $config[table_prefix] . "listingsFormElements WHERE ((" $config[table_prefix] . "listingsDBElements.listing_id = $listingID) AND (" $config[table_prefix] . "listingsFormElements.field_name = " $config[table_prefix] . "listingsDBElements.field_name) AND (" $config[table_prefix] . "listingsDBElements.field_name = $name))";

            
    $recordSet $conn->Execute($sql);
            if (
    $recordSet === false)
            {
                
    log_error($sql);
            }
            while (!
    $recordSet->EOF)
            {
                
    $field_value make_db_unsafe ($recordSet->fields[field_value]);
                echo 
    $field_value;
                
    $recordSet->MoveNext();
            }
        } 
    // end renderCity 
    I placed this above the renderTemplateArea function, then tried calling renderCity within renderTemplateArea:
    PHP Code:
    $city =    renderCity($listingID'city');
    echo 
    $city
    I know this isn't right; it generates that "contact admin" error.

    How can I pull the city in style.php so that I can present these links based on what city the currently viewed listing is in?

    Thank you in advance!
    JF

  2. #2
    Join Date
    Nov 2004
    Location
    Sanlucar de Barrameda, Spain.
    Age
    50
    Posts
    484

    Default Re: pull city in style.php

    This will output the town / city or what ever you want.

    <? renderSingleListingItemRaw($listingID, "town") ?>

    This is for Ver 1.1.5b so not sure if this was added for 1.1.4

    Ian

  3. #3
    Join Date
    Jan 2005
    Posts
    21

    Default Re: pull city in style.php

    Thank you for your quick reply!

    The renderSingleListingItemRaw function generates the "contact admin" error in style.php. Could that just because of *where* I've added that to style.php (it is after the actual function code by a couple hundred lines), or a symptom of another issue?

    All comments appreciated.
    JF

  4. #4
    Join Date
    Nov 2004
    Location
    Sanlucar de Barrameda, Spain.
    Age
    50
    Posts
    484

    Default Re: pull city in style.php

    You add it in the html or php page that the user will see i.e. listing browse etc...

    Ian

Bookmarks

Posting Permissions

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