ShopOS #

    ShopOS

:
http://www.getinfo.ru/article610.html - !
http://phpclub.ru/detail/article/db_tree

, ShopOS. , ( ), , . .

:
    ShopOS

. . , . , .

( index.html ):

    {php}
    $sql = "SELECT cat.categories_id, cd.categories_name FROM vip_categories cat, vip_categories_description cd WHERE cat.categories_status = '1' AND cd.categories_id = cat.categories_id";
    $sql = osDBquery($sql);
    while ($row = os_db_fetch_array($sql)) {
    $menu[$row['categories_id']] = $row['categories_name'];
    }
    foreach ($menu as $CatId => $CatName )
    {
    echo "
  • ".$CatName."";
    echo "
      ";
      $query = "SELECT * FROM
      vip_products p,
      vip_products_description pd,
      vip_products_to_categories p2c,
      vip_categories c
      WHERE
      c.categories_status='1'
      and p.products_status = '1'
      and p.products_id = p2c.products_id
      and p.products_id=pd.products_id
      and p2c.categories_id = '".$CatId."'
      and c.categories_id = '".$CatId."'
      ORDER by p.products_date_added";
      $query = osDBquery($query);
      while ($row1 = os_db_fetch_array($query)) {
      echo "
    • ".$row1['products_name']."
    • ";
      }
      echo "
  • ";
    }
    {/php}


:


, !
    ShopOS

! .

( index.html ):

    {php}
    $sql = "SELECT cat.categories_id, cat.parent_id, cat.categories_url, cd.categories_name FROM vip_categories cat, vip_categories_description cd WHERE cat.categories_status = '1' AND cd.categories_id = cat.categories_id ORDER BY cat.parent_id, cat.categories_id";
    $sql = osDBquery($sql);
    while ($row = os_db_fetch_array($sql)) {
    $menu[$row['parent_id']][$row['categories_id']] = $row['categories_name'];
    }
    foreach ($menu[0] as $CatId => $CatName )
    {
    echo "
  • ".$CatName."";
    if (isset($menu[$CatId])) {
    echo "
      ";
      foreach ($menu[$CatId] as $ItemId => $ItemName)
      {
      echo "
    • ".$ItemName."";
      echo "
        ";
        $query = "SELECT * FROM
        vip_products p,
        vip_products_description pd,
        vip_products_to_categories p2c,
        vip_categories c
        WHERE
        c.categories_status='1'
        and p.products_status = '1'
        and p.products_id = p2c.products_id
        and p.products_id=pd.products_id
        and p2c.categories_id = '".$ItemId."'
        and c.parent_id = '".$CatId."'
        ORDER by p.products_date_added";
        $query = osDBquery($query);
        while ($row1 = os_db_fetch_array($query)) {
        echo "
      • ".$row1['products_name']."
      • ";
        }
        echo "
      ";
      echo "
    • ";
      }
      echo "
  • ";
    } else { echo "";}
    }
    {/php}


:



- ( index.html ):


    {php}
    $sql = "SELECT cat.categories_id, cat.parent_id, cat.categories_url, cd.categories_name FROM vip_categories cat, vip_categories_description cd WHERE cat.categories_status = '1' AND cd.categories_id = cat.categories_id ORDER BY cat.parent_id, cat.categories_id";
    $sql = osDBquery($sql);
    while ($row = os_db_fetch_array($sql)) {
    $menu[$row['parent_id']][$row['categories_id']] = $row['categories_name'];
    }
    foreach ($menu[0] as $CatId => $CatName )
    {
    echo "
  • ".$CatName."";
    if (isset($menu[$CatId])) {
    echo "
      ";
      foreach ($menu[$CatId] as $ItemId => $ItemName)
      {
      echo "
    • ".$ItemName."";
      echo "
        ";
        $query = "SELECT * FROM
        vip_products p,
        vip_products_description pd,
        vip_products_to_categories p2c,
        vip_categories c
        WHERE
        c.categories_status='1'
        and p.products_status = '1'
        and p.products_id = p2c.products_id
        and p.products_id=pd.products_id
        and p2c.categories_id = '".$ItemId."'
        and c.parent_id = '".$CatId."'
        ORDER by p.products_date_added";
        $query = osDBquery($query);
        while ($row1 = os_db_fetch_array($query)) {
        //echo "
        ";
        //print_r($row1);
        //echo "
        ";
        echo "
      • ".$row1['products_name']."
      • ";
        }
        echo "
      ";
      echo "
    • ";
      }
      echo "
  • ";
    } else { echo "";}
    }
    {/php}


:

, . , ( UL), .

, . {$box_CATEGORIES}.

_\themes\_\source\inc\show_category.inc.php. $MaxLevel 1, , 1 .
:
if ($old_level > $level) {

:
if ( isset($GLOBALS['cPath']) ) {
if ( !strpos($GLOBALS['cPath'], "_")===false ) {
$path = explode('_',$GLOBALS['cPath']);
$query = "SELECT * FROM
vip_products p,
vip_products_description pd,
vip_products_to_categories p2c,
vip_categories c
WHERE
c.categories_status='1'
and p.products_status = '1'
and p.products_id = p2c.products_id
and p.products_id=pd.products_id
and p2c.categories_id = '".$path[1]."'
and c.parent_id = '".$path[0]."'
ORDER by p.products_date_added";
$query = osDBquery($query);
$categories_string .= "";
}
}

: cPath ( ), , , . - .
    ShopOS

, . -) .

UPD 02.09.11. + .
show_category.inc.php ( $foo[$cid]['name'].$ProductsCount. ''; - 114 )
if ($level == 3) {
if ( !empty($Aktiv)) {
//$categories_string .= $cid;
$query = "SELECT * FROM
vip_products_to_categories p2c,
vip_products p,
vip_products_description pd
WHERE
p2c.categories_id = '".$cid."'
and p.products_status = '1'
and p.products_id = p2c.products_id
and p.products_id=pd.products_id
ORDER by p.products_date_added";
$query = osDBquery($query);
$categories_string .= "
    ";
    while ($row1 = os_db_fetch_array($query)) {
    $categories_string .= "
  • [url=/product_info.php?products_id={$row1[]".$row1['products_name']."[/url]";
    }
    $categories_string .= "
";
}
}

PHP, / : mysql, smarty, db_tree, shopos / 07.06.11 / [0]

- Facebook & Vkontkte, +1 Google #

:
   - Facebook & Vkontkte, +1 Google

:
http://vkontakte.ru/developers.php?o=-1&p=Like
http://developers.facebook.com/docs/reference/plugins/like/
https://services.google.com/fb/forms/plusonesignup/
http://twitter.com/goodies/tweetbutton

:
( head):






:










/ : , , , / 03.06.11 / [0]

Jquery #

  Jquery

:
(function($) {
$(function() {

$('ul.tabs').delegate('li:not(.current)', 'click', function() {
$(this).addClass('current').siblings().removeClass('current')
.parents('div.section').find('div.box').hide().eq($(this).index()).fadeIn(150);
})

})
})(jQuery)

/

JavaScript, / : , tabs, jquery / 02.06.11 / [0]

jQuery #

   jQuery

. , .
/

JavaScript, / : jquery, img, gallery / 25.05.11 / [0]

php #

 php

. , :

set_time_limit(), :

ignore_user_abort(1);//
set_time_limit(0); //
do{
// , ..
if (file_exists( 'stop.txt'))
break;// ,
} while( true );
?>

, :

$start_time = microtime(); //
$start_array = explode(' ',$start_time); //
$start_time = $start_array[1] + $start_array[0]; //
ignore_user_abort(1);//
$max_exec = ini_get( 'max_execution_time' ); //
do{
// , ..
$now_time = microtime(); //
$now_array = explode(' ',$now_time);
$now_time = $now_array[1] + $now_array[0];
$exec_time = $now_time - $start_time; //
if (file_exists( 'stop.txt' ))
break; // ,
} while($exec_time > ($max_exec - 5)); // ,
// 5 , .
$http = fsockopen('site.ru', 80); //
fputs($http, "GET http://site.ru/script.php HTTP/1.0\r\n");
fputs($http, "Host: site.ru\r\n");
fputs($http, "\r\n");
fclose($http);
?>

. stop.txt.

PHP " ". HTTP, . cron.

function doSomthing()
{
// here we do somthing on server side
}
ignore_user_abort(false);
if (ob_get_level() == 0)
ob_start();
// redirect lient to some site or abort connecion
header("Location: http://www.example.com/");
ob_flush();
flush();
$counter = 1;
while (true)
{
ob_flush();
flush();
sleep(1);
doSomthing();
$counter++;
if ($counter == 30)
break;
}
ob_end_flush();
?>

, CRON'e -)

PHP / : php, / 23.05.11 / [0]

#



/ : / 21.05.11 / [0]