One site form each category in a new page

Discussion in 'Modifications' started by mohdsoft, Oct 25, 2006.

  1. mohdsoft

    mohdsoft Paid Customer

    One site form each category in a new page. How?

    Hi,

    I am wondring, is it possible to have a page say sponsered_by_cat.php which displays one sponsered site form each of the main catergories?

    I went through the code of Dir classes but i am getting confused the the "t1." thing that i can't understand why it is there.

    Any idea?
    Last edited: Oct 25, 2006
  2. John Turner

    John Turner New Member

    Hi,

    Please describe in more details your goal.

    t1 this is a synonym of table name which you have assigned

    for example, SELECT * FROM dir_links AS t1,
    t1 mentioned there dir_links.
  3. mohdsoft

    mohdsoft Paid Customer

    Hi,

    Thanks for the reply.
    What i want is simple. I want a new page, very similar to new links page but this one will be exclusively for sponsered links.

    Say i have 8 main categories in my directory. Each one have got some sponsered links in it. I want to display one link form each main category in one page. So the page will look something similar to the following:

    Technology (main category):
    Site title
    site description
    site URL

    -----

    Food (main category):
    Site title
    site description
    site URL

    etc
    .
    .

    Is that possible?
    Last edited: Oct 25, 2006
  4. John Turner

    John Turner New Member

    Hi,

    This is possible and it will cost for you $50.
    It would take up to 2-3 day to impliment this modification.
  5. mohdsoft

    mohdsoft Paid Customer

    Hi,

    That is too much for me. I will rephrase the question. I will have my own alogartiom to get the links from each category etc.

    My question is, How can i pull one sponsered link from the database using the same method the directory do? I can do every think i want using the ordinary coding, but using OOP with table name like t1 t2 made it a bit more complicated.

    looking at this code:

    function getSponsoredLinks($aCategory = 0, $aStart =0, $aLimit = 0)
    {
    $sql = "SELECT t2.*, t3.`name` plan ";
    $sql .= "FROM `{$this->mPrefix}sponsored` t1 ";
    $sql .= "LEFT JOIN `{$this->mPrefix}links` t2 ";
    $sql .= "ON t1.`id_link` = t2.`id` ";
    $sql .= "LEFT JOIN `{$this->mPrefix}plans` t3 ";
    $sql .= "ON t1.`id_plan` = t3.`id` ";
    $sql .= "LEFT JOIN `{$this->mPrefix}link_comments` t5 ";
    $sql .= "ON t5.`id_link` = t2.`id` ";
    $sql .= "LEFT JOIN `{$this->mPrefix}link_clicks` t6 ";
    $sql .= "ON t6.`id_link` = t2.`id` ";
    $sql .= "LEFT JOIN `{$this->mPrefix}link_categories` t7 ";
    $sql .= "ON t7.`id_link` = t2.`id` ";
    $sql .= $aCategory ? "WHERE t7.`id_category` <> '{$aCategory}' " : '';
    $sql .= "GROUP BY t2.`id` ";
    $sql .= "ORDER BY RAND() ";
    $sql .= $aLimit ? "LIMIT {$aStart}, {$aLimit}" : '';

    return $this->mDb->getAll($sql);
    }

    there is no where in the whole class where tables has been assigned to names like t1 t2 etc. Where has that been done and how can i identify which table refere to which shortcut?

    Also, to create a new page as new-links.php, what do i need? Is it done that way?:
    In new-links.php , the code which pulls the results form the database and then send them to the code in new-links.tpl.

    Is that right? where can i look to find out how results are being obtaned form the databse the same way the directory does?
  6. John Turner

    John Turner New Member

    Hi,

    In that example
    t1 this is allias for {$this->mPrefix}sponsored table
    t2 for {$this->mPrefix}links table

    and etc

    You may create new page in 'AdminPanel'->'manage pages' and use externall address for in, for example, group-sponsored.php, which you can get by copping new-links.php
  7. mohdsoft

    mohdsoft Paid Customer

    Hi,


    Thanks for the reply. I kind of get it now. Do you think that there will be any major changes in the way the script work or in the database in the next version (2)?
  8. John Turner

    John Turner New Member

    Hi,

    You are welcome.
    There are many changes in new pro version.
    I offer to wait new version has realized, after that makes any changes.
  9. mohdsoft

    mohdsoft Paid Customer

    Hi,

    Ok, i will wait then. Do you know when is the exact date for the new version to be released?

    Also, another question and sorry about asking alot.
    looking at this function:
    function getExpired($aStart = 0, $aLimit = 0)
    {
    $sql = "SELECT t1.`id_link`, t1.`id_plan` ";
    $sql .= "FROM `{$this->mPrefix}sponsored` t1 ";
    $sql .= "LEFT JOIN `{$this->mPrefix}plans` t2 ";
    $sql .= "ON t1.`id_plan` = t2.`id` ";
    $sql .= "WHERE t1.`start` + INTERVAL t2.`period` DAY < NOW()";

    return $this->getAll($sql);
    }

    I understand all of it except this final line:
    WHERE t1.`start` + INTERVAL t2.`period` DAY < NOW()";

    What is meant by "INTERVAL" and "DAY" here?
  10. John Turner

    John Turner New Member

    New pro version would be realized 31th of October.

    INTERVAL and DAY this is mysql date and time functions

Share This Page