هذا الهاك يسمح لزوار ورواد موقعك بإختيار الستايل الذي يريدونه هم

افتح ملف
رمز:
include/functions.php
ابحث عن
رمز:
function get_editor() {
أضف قبله مباشره
رمز:
function getusertheme() { global $mkportals, $mklib, $Skin, $DB, $mklib_board; $templates = array(); $userid = $mkportals->member['id']; $query = $DB->query("Select template from mkp_usertheme where userid = $userid"); $row = mysql_fetch_array($query); if (strpos($_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'], $mklib->forumpath)>0){ $folder = "../mkportal/templates/"; $path = "../"; } else{ $folder = "./mkportal/templates/"; $path = ""; } if ($dir = opendir($folder)) { while (($theme = readdir($dir)) !== false ){ if ($theme == '.' || $theme == '..' || $theme == 'temp' || substr($theme , -5,1) == '.' || substr($theme , -4,1) == '.' || substr($theme , -3,1) == '.') continue; if ($row['template']) $isselected = ($row['template'] == $theme) ? "selected" : ""; $option .= "<option $isselected value=\"$theme\">$theme</option>"; } closedir($dir); $select = "<select name=\"themex\">" . $option . "</select>"; $form = "<form style=\"margin: 0px\" method=\"post\" action=\"".$path."index.php?tid=1\">$select < input class=\"button\" type=\"submit\" value=\"إذهب\"></form>"; $out .= " <tr> <td class=\"alt1\" align=\"center\"><br>$form<br></td> </tr>"; } return $out; }
ابحث عن
رمز:
$mklib = new mklib;
أضف بعده مباشره
رمز:
$userid = $mkportals->member['id']; $query = $DB->query("Select template from mkp_usertheme where userid = $userid"); $row = mysql_fetch_array($query); if ($row['template'] && is_file ("".$MK_PATH."mkportal/templates/".$row['template']."/tpl_main.php")) { $MK_TEMPLATE = $row['template']; }
حمل ملف usertheme.php الى مجلد البلوكات blocks
افتح ملف
رمز:
modules/contents/index.php
ابحث عن
رمز:
$content = "";
اضف تحته مباشرة
رمز:
$tid = $mkportals->input['tid']; if ($tid) { $themex = $mkportals->input['themex']; $userid = $mkportals->member['id']; $query = $DB->query("select template from mkp_usertheme Where userid = $userid"); $row = mysql_fetch_array($query); if ($row['template']) $update = $DB->query("update mkp_usertheme set template = '$themex' where userid = $userid"); else $insert = $DB->query("insert into mkp_usertheme (userid, template) Values ($userid, '$themex')"); header("********: /"); exit; }
ازرع هذا الامر في الداتا بيز من خلال البي اتش بي ماي ادمن
رمز:
CREATE TABLE `mkp_usertheme` (`userid` INT( 10 ) NOT NULL DEFAULT '0',`template` VARCHAR( 50 ) NOT NULL ,PRIMARY KEY ( `userid` ) ) ENGINE = MYISAM ;
[ حمل الهاك ]