29 October 2010

How to access controller file directly without index.php in CodeIgnitor

code ignitor
To access controller file in codeIgnitor Framework directly without index.php as prefix, you need to create .htaccess file in your root directory.

Write the following lines in .htaccess file :

------------------------------------------------------------------------------------------
.htaccess
------------------------------------------------------------------------------------------

RewriteEngine on
RewriteCond $1 !^(index.php|images|robots.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]

--------------------------------------------------------------------------------------------

Note: If you cannot create .htaccess file in Windows OS then read this Post :

(If you found this article useful then share with your friends.)

How to Create .htaccess file in Windows OS ?

While creating a file manually with .htaccess , it gives a warning and says "You must type a file name" . So to create .htaccess file in Windows OS ,you need to follow this:
    htaccess
  1. Go to Start -> Run -> Type "notepad" and click OK.
  2. Write your code for .htaccess.After finish writing, go to File -> Save As
  3. Enter file name .htaccess
  4. Choose Save as type: All files
  5. click Save .
Done.



(If you found this article useful then share with your friends.)

24 October 2010

Some useful PHP MYSQL functions

php
PHP MYSQL functions helps to connect to the database in MySQL software.
These are some of the most frequently used function names :


mysql_connect — Open a connection to a MySQL Server

mysql_create_db — Create a MySQL database

mysql_error — Returns the text of the error message from previous MySQL operation

mysql_fetch_array — Fetch a result row as an associative array, a numeric array, or both

mysql_num_rows — Get number of rows in result

mysql_query — Send a MySQL query

mysql_tablename — Get table name of field

mysql_close — Close MySQL connection

(If you found this article useful then share with your friends.)

23 October 2010

File structure of custom joomla template

joomla
To create your own template in joomla , you need to create to follow file structure .
  1. templateDetails.xml
  2. index.php

-----------------------------------------------------------------
1. index.php
-----------------------------------------------------------------
<html>
<head>
<jdoc:include type="head" />
</head>
<body>
<jdoc:include type="message" />
<div class="center" align="center">Welcome to your own template</div>
<jdoc:include type="modules" name="debug" />
</body>
</html>

-----------------------------------------------------------------


-----------------------------------------------------------------
2. templateDetails.xml
-----------------------------------------------------------------
<?xml version="1.0" encoding="utf-8"?>
<install version="1.5" type="template">
<name>Name of the Template - zahid template</name>
<description>
This will be your first joomla template
</description>
<files>
<filename>index.php</filename>
<filename>templateDetails.xml</filename>
</files>
</install>

-----------------------------------------------------------------

After creating this two files , place it in a folder and copy this folder to the template folder inside the joomla folder.
  • Go to your joomla site administrator panel.
  • Go to Extensions -> Template Manager
  • Choose on the radio button of your newly created template and select Default button to active the template .
  • Go to the site or click Preview to see the results.

(If you found this article useful then share with your friends.)