Results 1 to 2 of 2

Thread: date and expiration display

  1. #1
    Join Date
    Jun 2003
    Location
    Pamiers (France)
    Posts
    88

    Default

    here, you can, (i hope :oops: )
    diplay, creation AND expiration date

    But, dont forget to change "default_" if you have need


    test it !

    Code:
    // for creation date
    function getCreationDate($listingID) 
    { 
    // get the main data for a given listing 
    global $conn, $lang; 
    $listingID = make_db_extra_safe($listingID); 
    
    $sql = "SELECT ID, creation_date FROM default_listingsDB WHERE (default_listingsDB.ID = $listingID)"; 
    $recordSet = $conn->Execute($sql); 
    if ($recordSet === false) log_error($sql); 
    
    // get main listings data 
    while (!$recordSet->EOF) 
    { 
    $formatted_creation = $recordSet->UserTimeStamp($recordSet->fields[creation_date],'d m  Y'); 
    $recordSet->MoveNext(); 
    } // end while 
    echo "Date Added : ".$formatted_creation; 
    } // function getCreationDate 
    
    // for Expiration  date
    function getExpiration ($listingID) 
    { 
    // get the main data for a given listing 
    global $conn, $lang; 
    $listingID = make_db_extra_safe($listingID); 
    
    $sql = "SELECT ID, expiration FROM default_listingsDB WHERE (default_listingsDB.ID = $listingID)"; 
    $recordSet = $conn->Execute($sql); 
    if ($recordSet === false) log_error($sql); 
    
    // get main listings data 
    while (!$recordSet->EOF) 
    { 
    $formatted_creation = $recordSet->UserTimeStamp($recordSet->fields[expiration],'d m  Y'); 
    $recordSet->MoveNext(); 
    } // end while 
    echo "Expiration : ".$formatted_creation; 
    } // function getExpiration
    include in "listinview.php"
    Code:
    <?php
    					getCreationDate&#40;$listingID&#41;
    					?>
    					<?php
    					getExpiration&#40;$listingID&#41;
    					?>
    result here:
    http://ariege-pyrenees.info/immo/lis...hp?listingID=1


    PS:

    i dont use ".$config[table_prefix]." because it seem to not working

    with: ".$config[table_prefix]."
    http://ariege-pyrenees.info/immo/lis...hp?listingID=2

    without: ".$config[table_prefix]."
    http://ariege-pyrenees.info/immo/lis...hp?listingID=2

    sorry, but the last night, i was so tired.........
    BUT, ...RealtyOne is here........... :wink:

  2. #2
    Join Date
    Apr 2003
    Location
    Charleville / Australia
    Posts
    1,421

    Default

    To use with the configured prefix you would need to add $config to your globals .

    Altered From above to work as dropin with language file use
    Add to main.php before ?>
    Code:
    // for creation date 
    function getCreationDate&#40;$listingID&#41; 
    &#123; 
    // get the main data for a given listing 
    global $conn, $lang, $config; 
    $listingID = make_db_extra_safe&#40;$listingID&#41;; 
    
    $sql = "SELECT ID, creation_date FROM ".$config&#91;table_prefix&#93;."listingsDB WHERE &#40;".$config&#91;table_prefix&#93;."listingsDB.ID = $listingID&#41;"; 
    $recordSet = $conn->Execute&#40;$sql&#41;; 
    if &#40;$recordSet === false&#41; log_error&#40;$sql&#41;; 
    
    // get main listings data 
    while &#40;!$recordSet->EOF&#41; 
    &#123; 
    $formatted_creation = $recordSet->UserTimeStamp&#40;$recordSet->fields&#91;creation_date&#93;,'d m  Y'&#41;; 
    $recordSet->MoveNext&#40;&#41;; 
    &#125; // end while 
    echo "".$lang&#91;'diaplay_date_added'&#93;." &#58; ".$formatted_creation; 
    &#125; // function getCreationDate 
    
    // for Expiration  date 
    function getExpiration &#40;$listingID&#41; 
    &#123; 
    // get the main data for a given listing 
    global $conn, $lang, $config; 
    $listingID = make_db_extra_safe&#40;$listingID&#41;; 
    
    $sql = "SELECT ID, expiration FROM ".$config&#91;table_prefix&#93;."listingsDB WHERE &#40;".$config&#91;table_prefix&#93;."listingsDB.ID = $listingID&#41;"; 
    $recordSet = $conn->Execute&#40;$sql&#41;; 
    if &#40;$recordSet === false&#41; log_error&#40;$sql&#41;; 
    
    // get main listings data 
    while &#40;!$recordSet->EOF&#41; 
    &#123; 
    $formatted_creation = $recordSet->UserTimeStamp&#40;$recordSet->fields&#91;expiration&#93;,'d m  Y'&#41;; 
    $recordSet->MoveNext&#40;&#41;; 
    &#125; // end while 
    echo "".$lang&#91;display_listing_Expiration&#93;." &#58; ".$formatted_creation; 
    &#125; // function getExpiration

    include in "listingview.php"

    Code:
    <?php 
                   getCreationDate&#40;$listingID&#41; 
     ?> 
    <?php 
                   getExpiration&#40;$listingID&#41; 
     ?>
    Add to your language file before final ?>
    Code:
    // extra Display option text
    $lang&#91;'diaplay_date_added'&#93; = "Date Added";
    $lang&#91;'display_listing_Expiration'&#93; = "Expiration";

Similar Threads

  1. VOW NAR compliance
    By lostsoul in forum HELP (CLOSED)
    Replies: 2
    Last Post: 09-05-2004, 01:34 PM
  2. Expiration Option
    By trevors in forum HELP (CLOSED)
    Replies: 2
    Last Post: 06-17-2004, 09:08 PM
  3. expiration feature
    By RealEstate in forum Feature Request (CLOSED)
    Replies: 0
    Last Post: 06-02-2004, 12:57 AM

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
  •