How to Get the Current Page URL

Sometimes, you might want to get the current page URL that is shown in the browser URL window. For example if you want to let your visitors submit a blog post to Digg you need to get that same exact URL. There are plenty of other reasons as well. Here is how you can do that.

Add the following code to a page:

 

<?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;
}
?>

You can now get the current page URL using the line:

<?php
echo curPageURL();
?>

Sometimes it is needed to get the page name only. The following example shows how to do it:

<?php
function curPageName() {
return substr($_SERVER[“SCRIPT_NAME”],strrpos($_SERVER[“SCRIPT_NAME”],”/”)+1);
}echo “The current page name is “.curPageName();
?>
IE:
After the function closes, add this:
————————————————————
$current_url = str_replace(“www.”, “”, curPageURL());echo $current_url;
—————————————————————
OR, i suppose we could use the explode() function:——————————————————–
$current_url = explode(“www.”,curPageURL());
$current_url = $current_url[1];
$current_url = “http://$current_url”;

echo echo $current_url;
———————————————————-
But str_replace would be faster

src: http://webcheatsheet.com/php/get_current_page_url.php

Binpress

The source-code marketplace
Binpress is a marketplace for source-code, where developers
can buy and sell source-code packages from each other.

Languages
PHP components
Ruby components
Python components
C# components
VB.NET components
Java components
JavaScript components
Other components

Helping buyers make a decision
Every package you publish has a dedicated landing page that is professionally designed and optimized for conversions. We use our expertise in design and user experience to help prospective buyers make a purchase decision.

Helping you sell your code
We invest heavily in several distribution channels including SEO and PPC campaigns, partnerships with affiliates and cross-site promotions.
We handle marketing for you and help you make the sale

via Binpress.

Shortcode Exec PHP – WordPress Plugins

Shortcode Exec PHP

Using this plugin you can execute arbitrary PHP code using shortcodes in your posts, pages and optionally in your widgets, just like manually defined shortcodes. The shortcodes and associated PHP code snippets are defined using the settings of this plugin. It is possible to parse and use shortcode parameters and to use shortcode content. Defined shortcodes can be deleted and disabled.

Advantages over other solutions:

  1. Your posts, pages and widgets do not have to contain PHP
  2. PHP code snippets can be reused
  3. All PHP code is organized at one place

Please report any issue you have with this plugin on the support page, so I can at least try to fix it.

Download

via WordPress › Shortcode Exec PHP « WordPress Plugins.

Best Practices for Magento Development

Best Practices for Magento Development

The Magento Team would like to invite you to join us for the kickoff of the Magento Developer Solutions Webinar series. The Magento Developer Solutions Webinar series is aimed at developers looking to learn more or increase their current knowledge of developing for the Magento eCommerce platform.

Please join us as we kick off our Magento Developer Solutions Webinar series with a joint webinar with Zend, the PHP Company, entitled “Best Practices for Magento Development”. Magento is the world’s fastest growing eCommerce platform thanks to a very vibrant and active developer community. Built using an Open Source model and industry leading technologies such as PHP and Zend Framework, Magento has over 1700 extensions through Magento Connect and also accepts code contributions directly from a world wide community of Magento contributors. Please join us for this special webinar covering best practices for Magento Development and get up to speed with coding for the most powerful and flexible eCommerce platform in the world.

Topics include:

  • Magento and Zend Framework Standards and Conventions
  • Magento Coding Style
  • How to Set Up a Magento Project in Zend Studio
  • Writing Good, Extendable Code and Magento Extendability Principles
  • Best Practices for Template Coding
  • How to become an official Magento Contributor and Submit Code

If you are a developer looking to to code for Magento, to extend Magento for your needs or for your customers, or to develop Magento extensions for Magento Connext, please join us on Wednesday February 10th at 9am Pacific Time for an inside look at the Best Practices for Magento Development.

Date: Wednesday, February 10th, 9:00 AM PST(GMT -08:00, Los Angeles)
Registration: https://www2.gotomeeting.com/register/911383602

Webalizer on Cpanel without login

ENter username + password + url  > Save as whatever.php wherever on the site   ie: stat/stat.php

And it’s ready

<?php
$user = ‘username’; //cpanel username
$pass = ‘password’; //cpanel password
$url = ‘www.domain.net’; //do not include ‘http://’

//retrieves the webalizer file, either .html or .png
function getFile($file) {
global $user, $pass, $url;
return file_get_contents(“http://” . $user . “:” . $pass . “@” . $url . “:2082/tmp/” . $user . “/webalizer/” . $file);
}
//alters links, either .html or .png
function changeLinks($subject, $type) {
return preg_replace(“/($type=”)(?!http)(.*?)”/is”,”$1$PHP_SELF?$2″”,$subject);
}

if(!empty($_SERVER[‘QUERY_STRING’])) {

//get file (whether png or html)
$page = getFile($_SERVER[‘QUERY_STRING’]);

//if png, output appropriate header
if(strpos($_SERVER[‘QUERY_STRING’],’.png’) !== false) {
header(“Content-type: image/png”);
}
//change the .png src(s)
else {
$page = changeLinks($page, ‘src’);
}
}
else {
//get index
$page = getFile(‘index.html’);
//change links
$page = changeLinks($page, ‘href’);

//change the usage.png src
$page = changeLinks($page, ‘src’);
}
//output it
echo $page;
?>

Essential PHP Techniques for Web Designer and Developers | Desizn Tech

Essential PHP Techniques for Web Designer and Developers | Desizn Tech.
If your are an web designer or developer pretty sure you know or heard about PHP. Just as a refresher, PHP is a server-side HTML embedded scripting language, which designed for producing dynamic web pages. It generally runs on a web server, taking PHP code as its input and creating web pages as output . Some PHP script requires general knowledge or Math and and logic. In this post, you will find 30 PHP tutorial and techniques that are not too complex and different. You can easily learn this techniques and implement them for your next project.