Google+

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Rezolvat $_GET Function NewPoints Shop
#1
Ma putei ajuta sa folosesc $_GET in urmatorul script a.i. la pluginul NewPoints Shop sa imi apara categoria dorita, de exemplu:

http://www.mydomain.com/newpoints.php?action=shop&sy=1 sa arate categoria ce are id 1

http://www.mydomain.com/newpoints.php?action=shop&sy=2 sa arate categoria ce are id 2

Uitati scriptul:

PHP Code:
1
2
3
4
5
6
7
8
9
10
11
function newpoints_shop_get_category($cid = 0)
{
    global $db, $mybb;
    if (!$cid)
        return false;
        
    $query = $db->simple_select('newpoints_shop_categories', '*', 'cid=\''.intval($cid).'\'');
    $cat = $db->fetch_array($query);
        
    return $cat;
} 

#2
Pentru a prelua anumite valori ale unor parametri, în MyBB nu se foloseşte variabila $_GET ci $mybb.
Uite cum poţi prelua :

PHP Code:
$cid = intval($mybb->input['sy']);

Users : collective term for those who use computers. Users are divided into three types : novice, intermediate and expert.
Novice users : people who are afraid that simply pressing a key might break their computer.
Intermediate users : people who don`t know how to fix their computer after they`ve just pressed a key that broke it.
Expert users : people who break other people`s computers.
#3
Si unde trebuie sa o pun?
#4
ma ajuta cineva?
#5
Păi va trebui să o pui în fişierul newpoints.php (cel din root), în cadrul unei structuri ce tratează acţiunea "shop". De exemplu poţi avea un if de acest gen :

PHP Code:
if ($mybb->input['action'] == 'shop') {
...
}

O pui într-o astfel de structură.

Users : collective term for those who use computers. Users are divided into three types : novice, intermediate and expert.
Novice users : people who are afraid that simply pressing a key might break their computer.
Intermediate users : people who don`t know how to fix their computer after they`ve just pressed a key that broke it.
Expert users : people who break other people`s computers.


Forum Jump:


Users browsing this thread: 1 Guest(s)