hi I am not professional in php.
I have a demo theme choose & have problem with that . in top menu of that we can insert text in evry menu. the problem is there are this code in body :
PHP Code:echo '<li ><a href="#" rel="' . $theme['url'] . ',' . $theme['themeforest'] . '">' .
ucfirst($theme['id']) .
' <span class="product-type">'.$theme['type'].'</span>';
and read from this code from tag in head:
when i dont write anythig in "type" in one option or delet this line from one option i want dont show any thing but show that style in my menu like small cubePHP Code:$theme_array = array (
array ("id" => "فونیکس (JM Phoenix)",
"type" => "joomla",
"link" => "phoenix",
"preview" => "http://localhost/5/screen/jm-ascent-blue.jpg",
"url" => "http://demo.joomi.ir/template/jmphoenix/",
"themeforest" => "http://buy"
),
array ("id" => "فونیکس (JM Phoenix)",
"link" => "phoenix",
"preview" => "http://localhost/5/screen/jm-ascent-blue.jpg",
"url" => "http://demo.joomi.ir/template/jmphoenix/",
"themeforest" => "http://buy"
)
);
like image:
asdasd.jpg
the full php code:
PHP Code:<?php
function is_firefox() {
$agent = '';
// old php user agent can be found here
if (!empty($HTTP_USER_AGENT))
$agent = $HTTP_USER_AGENT;
// newer versions of php do have useragent here.
if (empty($agent) && !empty($_SERVER["HTTP_USER_AGENT"]))
$agent = $_SERVER["HTTP_USER_AGENT"];
if (!empty($agent) && preg_match("/firefox/si", $agent))
return true;
return false;
}
function is_windows() {
$agent = '';
// old php user agent can be found here
if (!empty($HTTP_USER_AGENT))
$agent = $HTTP_USER_AGENT;
// newer versions of php do have useragent here.
if (empty($agent) && !empty($_SERVER["HTTP_USER_AGENT"]))
$agent = $_SERVER["HTTP_USER_AGENT"];
if (!empty($agent) && preg_match("/windows/si", $agent))
return true;
return false;
}
/*
File Name: Demo Switcher
Author: Halim KILIC
Version: 1.0
Author URI: http://tutspress.com
*/
## get current theme name
$current_theme = $_GET['theme'];
$theme_found = false;
## build theme data array
$theme_array = array (
array ("id" => "سیمرغ (JM Thunderbird)",
"link" => "Thunderbird",
"preview" => "http://localho/5/screen/jm-ascent-blue.jpg",
"url" => "http://demo.joomi.ir/tlate/jmphoenix/",
"themeforest" => "http://uy"
),
array ("id" => "فونیکس (JM Phoenix)",
"type" => "جوملا ۲.۵",
"free" => "رایگان",
"link" => "phoenix",
"preview" => "http://localhost/5/screen/jm-ascent-blue.jpg",
"url" => "http://demo.joomi.ir/template/jmphoenix/",
"themeforest" => "http://buy"
)
);
if (!$redirect) :
## get current theme data
foreach ($theme_array as $i => $theme) :
if ($theme['link'] == $current_theme) :
$current_theme_name = ucfirst($theme['id']);
$current_theme_url = $theme['url'];
$current_theme_purchase_url = $theme['themeforest'];
$theme_found = true;
endif;
endforeach;
if ($theme_found == false) :
$current_theme_name = $theme_array[0]['id'];
$current_theme_url = $theme_array[0]['url'];
$current_theme_purchase_url = $theme_array[0]['themeforest'];
endif;
?>
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>قالب فارسی جوملا <?php if ($theme_found == false) : echo $current_theme_name; else: echo $current_theme_name; endif; ?>| جوملا فارسی (Joomla)</title>
<link href='http://fonts.googleapis.com/css?family=Nobile' rel='stylesheet' type='text/css' />
<link href="selector/styles.css" rel="stylesheet" media="all" />
<!--[if IE]>
<style type="text/css">
li.purchase a {
padding-top: 5px;
background-position: 0px -4px;
}
li.remove_frame a {
padding-top: 5px;
background-position: 0px -3px;
}
#theme_select {
padding: 8px 8px;
}
#theme_list {
margin-top: 2px;
}
</style>
<![endif]-->
<style type="text/css">
<?php
if (is_firefox() && is_windows()) :
?>
li.purchase {
padding-top: 18px;
}
li.purchase a {
padding-top: 5px;
background-position: 0px -3px;
}
li.remove_frame {
padding-top: 18px;
}
li.remove_frame a {
padding-top: 5px;
background-position: 0px -2px;
}
#theme_select {
padding: 7px 8px;
}
<?php
endif;
?>
</style>
<script type="text/javascript" src="selector/jquery-1.4.2.min.js"></script>
<script src="selector/main.js" type="text/javascript"></script>
<script type="text/javascript">
var theme_list_open = false;
$(document).ready(function () {
function fixHeight () {
var headerHeight = $("#switcher").height();
$("#iframe").attr("height", (($(window).height() - 10) - headerHeight) + 'px');
}
$(window).resize(function () {
fixHeight();
}).resize();
$("#theme_select").click( function () {
if (theme_list_open == true) {
$(".center ul li ul").hide();
theme_list_open = false;
} else {
$(".center ul li ul").show();
theme_list_open = true;
}
return false;
});
$("#theme_list ul li a").click(function () {
var theme_data = $(this).attr("rel").split(",");
$("li.purchase a").attr("href", theme_data[1]);
$("li.remove_frame a").attr("href", theme_data[0]);
$("#iframe").attr("src", theme_data[0]);
$("#theme_list a#theme_select").text($(this).text());
$(".center ul li ul").hide();
theme_list_open = false;
return false;
});
});
</script>
</head>
<body>
<div id="switcher">
<div class="center">
<ul>
<li><img class="logo" src="selector/logo.png" alt="" /></li>
<li class="name"><p>:نسخه نمایشی قالب های جوملا</p></li>
<li id="theme_list"><a id="theme_select" href="#"><?php if ($theme_found == false) : echo "یک قالب را انتخاب نمایید"; else: echo $current_theme_name; endif; ?></a>
<ul>
<?php
foreach ($theme_array as $i => $theme) :
echo '<li ><a href="#" rel="' . $theme['url'] . ',' . $theme['themeforest'] . '">' .
ucfirst($theme['id']) .
' <span class="product-type">'.$theme['type'].'</span>';
if(isset($theme['preview'])){
echo '<span class="product-preview"><img src="';
if(strpos($theme['preview'], 'http://') === false){
echo 'product_previews/'.$theme['preview'];
}
else echo $theme['preview'];
echo '" /></span>';
}
echo '</a></li>';
endforeach;
?>
</ul>
</li>
<li class="purchase" rel="<?php echo $current_theme_purchase_url; ?>"><a href="<?php echo $current_theme_purchase_url; ?>"></a></li>
<li class="purchase1" ><a href="http://extentions"></a></li>
<li class="remove_frame" rel="<?php echo $current_theme_url; ?>"><a href="<?php echo $current_theme_url; ?>"></a></li>
</div>
</ul>
</div>
<iframe id="iframe" src="<?php echo $current_theme_url; ?>" frameborder="0" width="100%"></iframe>
</body>
</html>
<?php
endif;
?>


Reply With Quote

Bookmarks