Fixed – WordPress Update – “Unable To Locate WordPress Plugin Directory”

To fix this WordPress Issue – “Unable To Locate WordPress Plugin Directory” during WordPress Plugin Update.

Modify wp-config.php and add the code below at the bottom of the file:

if(is_admin()) {
	add_filter('filesystem_method', create_function('$a', 'return "direct";' ));
	define( 'FS_CHMOD_DIR', 0751 );
}
Posted in Wordpress | Comments Off on Fixed – WordPress Update – “Unable To Locate WordPress Plugin Directory”

WordPress – Nino SEO Title Tag

WordPress plugin that prepend and/or append keyword on title tag for SEO purposes.

Download

Nino - SEO - Title Tag
Title: Nino - SEO - Title Tag (1104 clicks)
Caption:
Filename: nino-seo-title-tag-3.zip
Size: 18 KB

Posted in Wordpress, WP Plugins | 6 Comments

Remove element from Array

Remove element from array
array_diff($arr1, $arr2)
array_diff_key($arr1, $arr2)

<?php
$a1 = array('a'=>1, 'b'=>2, 'c'=>3, 'd'=>4);
$a2 = array('a'=>'', 'c'=>'');
$a3 = array(1, 2, 4);

$result = array_diff_key($a1, $a2);
print_r($result);

$result = array_diff($a1, $a3);
print_r($result);
?>

Output

Array ( [b] => 2 [d] => 4 )
Array ( [c] => 3 ) 
Posted in Array Helper Functions, Useful PHP Functions | 2 Comments

Embedding PHP in HTML

Embedding PHP in HTML is so easy.

<html>
	<head>
	<title>PHP in HTML</title>
	</head>
	<body>
		
		<?php
			echo "Hello World";
		?>
		
		<p>Hi Universe!</p>
		
		<ul>
			<?php
				for($i=10; $i>0; $i--) {
			?>
				<li>
					This is number 
					<?php
						echo $i;
					?>
				</li>
			<?php
				}
			?>
		</ul>
	</body>
</html>

The following codes are the PHP codes that were embedded in our above HTML source code.

<?php
	echo "Hello World";
?>
...
...
<?php
	for($i=10; $i>0; $i--) {
?>
...
...
<?php
	echo $i;
?>
...
...
<?php
	}
?>

Embedding the PHP Code inside your HTML is a good programming style. It will help you develop web site much more faster and easier.

In our future discussion will have more advance of embedding techniques. Hope that helps and Thank you.

Posted in PHP Beginners Course, PHP Tutorial | 3 Comments

First Program: Hello World

Requirements:

  • Text Editor: Notepad++ (Recommended)
  • XAMPP
  • Browser: Chrome, Mozilla, or Internet Explorer

Problem:
Write a program that will print “Hello World” in php (without the qoutes).

Solution:
1. Open up Notepad++
2. Enter the source code below and save as “helloworld.php” inside your root directory, example, C:/xampp/htdocs/php-beginners.com/ex1/helloworld.php

<?php
echo "Hello World";
?>

3. Open up your browser and visit this address – http://localhost/php-beginners.com/ex1/helloworld.php or simply click the link.

4. It should display “Hello World” (without the qoutes) in your browser.

Congratulations! You have successfully run a simple php program. We will have more of these in our future discussions.

Thank you.

Posted in PHP Beginners Course, PHP Tutorial | Tagged , | 3 Comments