How to get Current Page URL in via PHP?

<?php
function curPageURL() {
$pageURL = ‘http’;
if ($_SERVER[“HTTPS”] == “on”) {$pageURL .= “s”;}
$pageURL .= “://”;
if ($_SERVER[“SERVER_PORT”] != “80”) {
$pageURL .= $_SERVER[“SERVER_NAME”].”:”.$_SERVER[“SERVER_PORT”].$_SERVER[“REQUEST_URI”];
} else {
$pageURL .= $_SERVER[“SERVER_NAME”].$_SERVER[“REQUEST_URI”];
}
return $pageURL;
}

$url =  curPageURL();

//print_r(parse_url($url));

$URLpath = parse_url($url, PHP_URL_PATH);

$langPathAraay = explode(“/”, $URLpath);
$langPath = $langPathAraay[1];
//echo $langPath;

if($langPath == ‘agd_nl’){
//echo “here”;
echo $this->getLayout()->createBlock(‘catalog/product_list’)->setRowCount(1)->setCategoryId(108)->setTemplate(‘catalog/product/list.phtml’)->toHtml();
}
else if($langPath==”agd_be”){
echo $this->getLayout()->createBlock(‘catalog/product_list’)->setRowCount(1)->setCategoryId(98)->setTemplate(‘catalog/product/list.phtml’)->toHtml();
}
else if($langPath==”agd_befr”){
echo $this->getLayout()->createBlock(‘catalog/product_list’)->setRowCount(1)->setCategoryId(98)->setTemplate(‘catalog/product/list.phtml’)->toHtml();
}
else if($langPath==”agb_de”){
echo $this->getLayout()->createBlock(‘catalog/product_list’)->setRowCount(1)->setCategoryId(105)->setTemplate(‘catalog/product/list.phtml’)->toHtml();
}
else if($langPath==”agb_fr”){
echo $this->getLayout()->createBlock(‘catalog/product_list’)->setRowCount(1)->setCategoryId(106)->setTemplate(‘catalog/product/list.phtml’)->toHtml();
}
else if($langPath==”agb_gb”){
echo $this->getLayout()->createBlock(‘catalog/product_list’)->setRowCount(1)->setCategoryId(107)->setTemplate(‘catalog/product/list.phtml’)->toHtml();
}
else{
echo $this->getLayout()->createBlock(‘catalog/product_list’)->setRowCount(1)->setCategoryId(108)->setTemplate(‘catalog/product/list.phtml’)->toHtml();
}
?>

How to read Current Browser URL via javascript?

<script language=”javascript” type=”text/javascript”>

function DinkyToy()
{
var pageURL = document.location.href;
var MyArray = pageURL.split(“?”)  ;
var BaseURL = MyArray[0];
var MyLangArray = pageURL.split(“/”);
var LangURL = MyLangArray[3];
/* Any variables would be appended */
/* using the ? and would appear in */
/* MyArray[1] */

//alert(‘pageURL = ‘ + pageURL)
//alert(‘BaseURL = ‘ + BaseURL)
alert(‘LangURL = ‘ + LangURL)

}
window.onload = DinkyToy();
</script>

How to chnage qTranslate language switcher?

You put below 1 line query only in your page. Other queries you want use your style.

1. qtrans_generateLanguageSelectCode(‘dropdown’);

2. How to get current qTranslate language : qtrans_getLanguage();

3. How to avoid home link reset the current language : just put this line “bloginfo( ‘url’ );” in link part.

You find this line echo "<li $current>
<a href='".get_settings('home')."'>Home</a></li>"; 
and remove the href quotation part. then you put above line you can use very nice.

4.  Create dropdown fields for each language
<?php
foreach(qtrans_getSortedLanguages() as $language) {
echo $language;
}

?>

5. qtranslate language convert url :  <?php echo qtrans_convertURL($url, $lang); ?>

🙂 that is all. Enjoy…

thanks for all google users. I found lot of time to spent this. I search more keyword then i find this above topics. So, again i tell you thanks for all google users.

How to View Current Page Sub Page only?

Hi, Below code is very nice,

<?php

$args = array(
‘numberposts’ => -1,
‘post_parent’ => $post->ID,
‘post_type’ => ‘page’,
‘post_status’ => ‘publish’,
‘orderby’ => ‘menu_order,title’,
‘order’ => ‘ASC’
);
$my_pagelist = &get_children($args);

if ($my_pagelist) {
foreach($my_pagelist as $my_child) {
$my_child_slug = $my_slug . ‘/’. $my_child->post_name.’/’;
$my_content = apply_filters(‘the_content’,$my_child->post_content);
$my_content = str_replace(‘]]>’, ‘]]>’, $my_content);
echo $my_content;
}
}
?>

This is reference site :
http://codex.wordpress.org/Function_Reference/wp_list_pages
http://wordpress.org/support/topic/display-subpage-content-on-parent-page
🙂

How to create wp curve menu css ?

You can use below coding that is useful for curve menu creation.

/* =Menu
————————————————————– */
#top-bar-bg{
background: #820086;
border-bottom:8px solid #000;
padding:20px 0 0 0;

}
div.search_container{
position:absolute;
top:0;
right:0;
}
div.search_container input.keywords{
font:12px Arial, Helvetica, sans-serif;
float:left;
}
#access {
display: block;
margin: 0 auto;
width: 940px;
position:relative;
}
#access .menu-header,
div.menu {
font-size: 13px;
margin-left: 12px;
width: 928px;
}
#access .menu-header ul,
div.menu ul {
list-style: none;
margin: 0;
}
#access .menu-header li,
div.menu li {
float: left;
position: relative;
}
#access a {
display: block;
line-height: 38px;
text-decoration: none;
/*-moz-border-radius-topleft:5px;
-moz-border-radius-topright:5px;*/
font:14px Arial, Helvetica, sans-serif;
padding:10px;
}
#access ul li {
color: #9D9B9B;
background:url(images/menu-normal-right.jpg) no-repeat top right;
margin-right:10px;
}
#access ul li a{
color: #9D9B9B;
background:url(images/menu-normal-left.jpg) no-repeat top left;
}

#access ul ul {
/*box-shadow: 0px 3px 3px rgba(0,0,0,0.2);
-moz-box-shadow: 0px 3px 3px rgba(0,0,0,0.2);
-webkit-box-shadow: 0px 3px 3px rgba(0,0,0,0.2);*/
display: none;
position: absolute;
top: 38px;
left: 0;
float: left;
width: 180px;
z-index: 99999;
}
#access ul ul li {
min-width: 180px;
}
#access ul ul ul {
left: 100%;
top: 0;
}
#access ul ul a {
background: #333;
line-height: 1em;
padding: 10px;
width: 160px;
height: auto;
}
#access li:hover {
background:url(images/menu-hilight-right.jpg) no-repeat top right;
color: #000;
}
#access li:hover > a,
#access ul ul :hover > a {
background:url(images/menu-hilight-left.jpg) no-repeat top left;
color: #000;
}
#access ul li:hover > ul {
display: block;
}
#access ul li.current_page_item,
#access ul li.current-menu-ancestor,
#access ul li.current-menu-item,
#access ul li.current-menu-parent {
background:url(images/menu-hilight-right.jpg) no-repeat top right;
color: #000;

}
#access ul li.current_page_item > a,
#access ul li.current-menu-ancestor > a,
#access ul li.current-menu-item > a,
#access ul li.current-menu-parent > a {
background:url(images/menu-hilight-left.jpg) no-repeat top left;
color: #000;

}
* html #access ul li.current_page_item,
* html #access ul li.current-menu-ancestor,
* html #access ul li.current-menu-item,
* html #access ul li.current-menu-parent,
* html #access ul li{
background:url(images/menu-hilight-right.jpg) no-repeat top right;
color: #000;
}
* html #access ul li.current_page_item a,
* html #access ul li.current-menu-ancestor a,
* html #access ul li.current-menu-item a,
* html #access ul li.current-menu-parent a,
* html #access ul li a:hover {
background:url(images/menu-hilight-left.jpg) no-repeat top left;
color: #000;
}

that’s all. 🙂

Other one Option :

/* =Menu
————————————————————– */

#access {
display: block;
float: left;
margin: 0 auto 0 auto;
width: 500px;
height:29px;
position:absolute;
top:39px;
right:0px;
}
#access .menu-header,
#access .menu-header ul.menu {
font:12px “Myriad Pro”, Arial, Helvetica, sans-serif, Verdana;
color:#9CB2E4;
margin-left: 12px;
width: 420px;
float:right;
}
#access .menu-header ul,
#access .menu-header ul.menu ul {
list-style: none;
margin: 0;
}
#access .menu-header li,
#access .menu-header ul.menu li {
float: left;
position: relative;
padding:0 0 0 0;
}
#access .menu-header a {
color:#9CB2E4;
font:bold 12px “Trebuchet MS”, Arial, Helvetica, sans-serif;
text-decoration:none;
padding:13px 0 13px 0;
text-decoration: none;
background: url(images/topmenuright.gif) no-repeat right;
}
#access .menu-header ul li a span { padding:13px 15px; background: url(images/topmenuleft.gif) no-repeat left;}
#access .menu-header ul ul {
box-shadow: 0px 3px 3px rgba(0,0,0,0.2);
-moz-box-shadow: 0px 3px 3px rgba(0,0,0,0.2);
-webkit-box-shadow: 0px 3px 3px rgba(0,0,0,0.2);
display: none;
position: absolute;
top: 38px;
left: 0;
float: left;
width: 180px;
z-index: 99999;
}
#access .menu-header ul li a{
margin:0 5px;
float:left;
}
#access .menu-header ul ul li {
min-width: 180px;
padding:13px 10px;
}
#access .menu-header ul ul ul {
left: 100%;
top: 0;
}
#access .menu-header ul ul a {
/*background: transparent;*/
line-height: 1em;
padding: 15px;
width: 160px;
height: auto;
}
#access .menu-header li:hover > a,
#access .menu-header ul ul :hover > a {

color:#fff; background: url(images/topmenurighthover.gif) no-repeat right;
}
#access .menu-header li:hover > a span,
#access .menu-header ul ul :hover > a span{color:#fff; background:url(images/topmenulefthover.gif) no-repeat left; }

#access .menu-header ul li:hover > ul {
display: block;
}
#access .menu-header ul li.current_page_item > a,
#access .menu-header ul li.current-menu-ancestor > a,
#access .menu-header ul li.current-menu-item > a,
#access .menu-header ul li.current-menu-parent > a {
color:#fff; background:url(images/topmenurighthover.gif) no-repeat right;
}
#access .menu-header ul li.current_page_item > a span,
#access .menu-header ul li.current-menu-ancestor > a span,
#access .menu-header ul li.current-menu-item > a span,
#access .menu-header ul li.current-menu-parent > a span{
color:#fff; background:url(images/topmenulefthover.gif) no-repeat left; }

* html #access .menu-header ul li.current_page_item a,
* html #access .menu-header ul li.current-menu-ancestor a,
* html #access .menu-header ul li.current-menu-item a,
* html #access .menu-header ul li.current-menu-parent a,
* html #access .menu-header ul li a:hover {
color:#fff; background:url(images/topmenurighthover.gif) no-repeat right;
}
* html #access .menu-header ul li.current_page_item a span { color:#fff; background:url(images/topmenulefthover.gif) no-repeat left; }

© 2020 Spirituality