rss

About Me

My Photo
irnanto dwi saputra
View my complete profile
Showing posts with label PHP. Show all posts
Showing posts with label PHP. Show all posts

12 November 2012

How To Create a Sitemap in Wordpress

Sitemap is a page that shows the parts or links contained on the site. Sitemap devoted to two things for search engines and for the user (human). This time I will give a little tutorial on how to create a sitemap in wordpress for user. Here I am using a CMS wordpress hosting service that has the facility to use a PHP file. OK we just practice how to create a sitemap in wordpress.
The steps that you should follow the following :
  1. Login to cpanel your website
  2. Open the file manager
  3. Go to the directory of your website template is being actively used
    example: public_html / wp-content / themes / name-theme
  4. Create a new file with the name sitemap.php
  5. Copy or type the code below in file sitemap.php
    <?php
    /*
    Template Name: Sitemap
    */
    ?>
    <?php get_header(); ?>

    <div id="content" >
      <div class="post">
        <div class="title">
          <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>">
            <?php the_title(); ?>
    <!-- ----------------- Display Post with its relative category ----------------- -->
            </a></h2>
        </div>
        <div class="entry siteMap">
          <h2 id="posts">Posts</h2>
          <ul>
            <?php
    // Add categories seprated with comma (,) you'd like to hide to display on sitemap
    $cats = get_categories('exclude=');
    foreach ($cats as $cat) {
      echo "<li><h3>".$cat->cat_name."</h3>";
      echo "<ul>";
      query_posts('posts_per_page=-1&cat='.$cat->cat_ID);
      while(have_posts()) {
        the_post();
        $category = get_the_category();
      
        for($xi=0;$xi<=5;$xi++){
        if ($category[$xi]->cat_ID == $cat->cat_ID) {
          echo '<li><a href="'.get_permalink().'">'.get_the_title().'</a></li>';
        }
        }
      }
      echo "</ul>";
      echo "</li>";
    }
    ?>
          </ul>
    <!-- ----------------- Display Categories ----------------- -->
          <h2>Categories</h2>
          <ul>
            <?php wp_list_cats("sort_column=name&feed_image=/wp-content/themes/wizer/images/rss-ball.jpg&optioncount=1&hierarchical=0"); ?>
          </ul>
    <!-- ----------------- Display Pages ----------------- -->
          <h2 id="pages">Pages</h2>
          <ul>
            <?php
    // Add pages seprated with comma[,] that you'd like to hide to display on sitemap
    wp_list_pages(
      array(
        'exclude' => '',
        'title_li' => '',
      )
    );
    ?>
          </ul>
        </div>
      </div>
    </div>
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>
  6. Save file sitemap.php
  7. Login to your-domain/wp-admin
  8. Click the page menu
  9. Select add new
  10. Type the title "Sitemap" without quotes
  11. On the Page Attributes -> Template
    How To Create a Sitemap in Wordpress
  12. Select sitemap
  13. Click Publish
Now look at the results in your web menus. For demo please visit this website.
Read more.....

24 September 2011

Using the Echo or Print

Hello, this time I will try to discuss two functions that we often use, ie, echo and print, we made dizzy sometimes between two options, using echo or print when you want to display the contents of a variable, or just display as plain text alerts of a process that has been done. Echo or Print? Echo or Print? Echo or Print? and so on ... A little confused indeed.

In addition to print php echo and also provides many alternatives for the syntax of another, different function but the task remains the same, plus dizziness, more confused.

The author himself is quite confused to choose one of them, echo or print? echo or print? but after studying the various existing CMS like joomla, drupal, wordpress, it turns out they are the web developers tend to use echo rather than print, then what is the reason?

Let us go into. Php language a developer ever do the testing, and the result is the echo is 15% faster process than the print function (in millisecond). And it is common knowledge that if the print is a function that returns the value in it (returning value). And there is another reason why most developers prefer to use echo rather than print, another reason is, time efficiency, because the echo was only requires 4 letters to be typed, while the print it has 5 letters to be typed. But this is reality. A lazy programmer to write the letter 't'. And this has become a natural human instinct, choose a shorter. Still the same.

Okay, for further efficiency is the use of:
echo "$ variable1 and". "$ Variable2 to be displayed". "Put here";

it takes a lot of resources, because the dot has a function to mengadd / add the contents of a variable, instead of connecting or forwarding. The difference between adding a forward is like this:

Adding it to have meaning, opening up a new variable and then add the contents into the variable, then closes the variable. While the connect or continue to have meaning, its variable was content to continue living variablenya opened. Adding consists of three processes, while connecting or meneruskaan just doing one process.

Good use of echo is as follows:
echo $ variable, "and", $ variable2, "which will be displayed", "put here";

I separate each word here only as a simulation of actual cases. Echo is good it's not use a dot to connect each variable, or display text, but use a comma. So the process is faster, and fewer and fewer resources required.

Read more.....

23 March 2011

History of PHP

PHP was first invented by Rasmus Lerdorf in 1994. Originally, PHP stands for Personal Home Page (Personal Site) and used to

record the number and to find out who his visitors on the homepage. Rasmus Lerdorf is one of the supporters of open source.Oleh therefore, he issued a Personal Home Page Tool version 1.0 for free. By removing the Personal Home Page Tools versions 1.0 to open source, so many programmers who are interested to participate in developing PHP.

In November 1997, released PHP 2.0. In this release, the PHP interpreter has been implemented in C program In this release also included the extension modules significantly enhance the ability of PHP.

In 1997, a company called Zend PHP interpreter to rewrite a cleaner, better, and faster. Then in June 1998, the company released a new interpreter for PHP and the formalizing such as the release of PHP 3.0 and PHP acronym was changed to recurring acronym for PHP: Hypertext Preprocessing.

In mid-1999, Zend released a new PHP interpreter and release is known with PHP 4.0. PHP version PHP 4.0 is the most widely used at the beginning of the 21st century. This version is widely used due to its ability to build complex web applications but still has the speed and stability.

In June 2004, Zend PHP 5.0 release. In this version, the core of the PHP interpreter underwent major changes. This version also includes object-oriented programming model into the PHP programming language to respond to developments in the direction of object-oriented paradigm.

Read more.....

16 March 2011

PHP Advantages

PHP has many advantages that are not owned by a kind of script language. PHP is focused on server-side scripting, which can do anything that can be done by CGI, such as collect form data, generate dynamic web page content, and the ability to send and receive cookies, even more than the ability of CGI.

PHP can be used on

all operating systems, including Linux, Microsoft Windows, Unix, Mac OS, RISC OS. PHP also supports a web server such as Apache, Microsoft Internet Information Server (MIIS), Personal Web Server (PWS), Netscape and iPlanet servers, Oreilly Website Pro server, audium, Xitami, OmniHTTPd, and many others, even PHP can work as a CGI processor.

PHP does not terbtas in the output HTML (Hypertext Markup Language). PHP also has the ability to process the output images, PDF files, and Flash movies. PHP can also produce text such as XHTML and other XML files.

One feature that can be relied upon by PHP is its support for multiple databases. Here's a database that can be supported by PHP.

  • Adabas D
  • dBase
  • Direct MS-SQL
  • Empress
  • FilePro (read only)
  • FrontBase
  • Hyperwave
  • IBM DB2
  • Informix
  • Ingres
  • InterBase
  • MSQL
  • MySQL
  • ODB
  • Oracle (OC17 and OC 18)
  • Ovrimos
  • PostgrSQL
  • Solid
  • Sybase
  • Unix DBM
  • Velocis

Read more.....

11 March 2011

PHP

PHP stands for PHP Hypertext Prepocessor used as a server-side scripting languages in web programming that is inserted in a html document.

Use of PHP allows web can be

made dynamic so that the maintenance web sitis has become much easier and efficient. PHP can also be used to build a CMS.

PHP is Open Source software is distributed and licensed free of charge and can be downloaded for free from the official website http://www.php.net. PHP was written using C language.

Syntax PHP program or script written in PHP clamp special mark. There are four different pairs of PHP tags that can be used to mark the script PHP blog:

  1. <? php ..... ?>
  2. <script language="php"> ..... </ script>
  3. <? ..... ?>
  4. <% ..... %>

Mode 1 and 2 is the most commonly used, although three seems more practical way because the way the 3 is not always enabled in php.ini configuration file contained in the directory c:\apache\php.

How 4 also has possibility easy for those of you who are familiar with the ASP (Active Server Page). However, if it is not known, it must be done pengaktifanpada php.ini configuration file.

Read more.....
 

Site Info

Google Pagerank Powered by  MyPagerank.Net My Ping in TotalPing.com TopOfBlogs My Zimbio Blog Directory