Saturday, March 12, 2011

How to install zen cart?

Getting Started ...
This is a basic guide to installing Zen Cart™. If you already have Zen Cart™ installed and wish to upgrade from a previous version to this new release, please see the Upgrade Instructions and the What's New documentation.
The Basics
You have downloaded the Zen Cart™ software for an online shopping cart.
Questions to ask yourself ...
1. Do you have a domain?
If No, stop ... see our Certified Hosting Sites and find a fast, reliable hosting site that can help you register your own personal domain as well as provide for your hosting needs that meet the Zen Cart™ software requirements ...
2. Do you have FTP software?
If No, stop ... you need to obtain a decent FTP software package such as FileZilla (free on Windows and Mac) to transfer files back and forth from your computer to your webserver.
Note: webserver meaning, the computer on the internet where you have your domain hosted (See #1 above).

NOTE: Many people have had timeout and other problems when using programs like SmartFTP and CuteFTP. We recommend that you do NOT use these problematic programs.

NOTE 2: If your hosting company provides an FTP program that runs inside your browser, we recommend that you do NOT use that for uploading large amounts of files such as a fresh install of Zen Cart. Those are okay for single-file uploads, but unreliable for several files at once.
NOTE 3: While some programs like Dreamweaver have built-in FTP capability, we DO NOT recommend using these programs for uploading more than one file at a time, since they often fail to do mass uploads properly, and do a very poor job of informing you of any failures. Always better to use a program dedicated to FTP activity, and not something that's merely got rudimentary FTP capability bolted on.

3. Do you have a good Text Editor?
If No stop ... you will need a good Text Editing software such as Notepad++ (free), UltraEdit, CrimsonEditor (free), BBedit/TextWrangler(Mac), Kedit (linux), or some other type of Text Editor for modifying the files in the Zen Cart™ software ...
Note: do not use cPanel for editing files, nor MS Word or other software designed for fancy writing ... you want a nice clean Text Editor.
You can use the Windows Notepad... but this is limited in capabilities and the size of files that it can open and often can cause more harm than good ... (Notepad++ mentioned above is the most recommended choice.)
4. Do you have access to your webhosting control panel to create a MySQL database and user?
BEFORE YOU PROCEED, make sure you have access to a MySQL database, and username/password to that database. You may need to create the database using your webhosting account's control panel. Contact your webhosting company for assistance. Zen Cart™ cannot create the database for you.
(You need the following permissions on your MySQL user: SELECT, INSERT, UPDATE, DELETE, CREATE, ALTER, INDEX, DROP. On an hSphere host, this would be "dba" access, or at least read/write. )
All set?
If you have answered Yes to all 4 of these questions, then you are ready to go on ...
ZIP file
If you're reading this page via a file from your computer, you have likely already unzipped the Zen Cart™ distribution file and its contents into a folder on your personal computer. If for some reason you haven't already done so, unzip the files to your PC now, retaining the file structure within the zip file.
Upload the Zen Cart™ fileset to your webserver
Upload, via FTP, the whole program into a directory on your server. Example: /catalog
(We will use "/catalog" as an example in this document. You can choose "no" foldername, or something else if you prefer, such as "/zencart", or "/store" etc)

NOTE: As you upload your files, make sure that your FTP program and your webserver allow "long filenames". Some old FTP software may shorten names longer than 11 letters, and that would cause a problem with uploading Zen Cart files.
What folder do I upload into?
Each web host has his/her own preference in naming folders for use in running a website.
You can have many files that don't even get shown to the public. The ones that are available for access via a browser are usually in a folder called something like:
- /home/YOURNAME/public_html
or
- /var/www/YOURNAME/httpdocs
or
- /usr/accounts/a/b/YOURNAME/httpd
etc, etc, etc
Basically, in your FTP area look for a "www" or "public_html" or "htdocs" or "httpdocs" or "wwwroot" folder. These are the common folder names for what is referred to as the "webroot", which is where all website content is served from.

Your Zen Cart files (or *any* files to run your website, for that matter) need to be under that folder. If they're not, then you're going to get "not found" errors ... because the content is not found!
If it's unclear where the publicly-accessible files are to be uploaded, ask your hosting company for assistance in determining what your "webroot" folder should be.

REMEMBER ... this guide uses the "/catalog" folder AS AN EXAMPLE. You don't "have to" use "/catalog". You could use something else, or nothing at all if you prefer to install in the "root" (which is the "base" of your website).
Creating the configure.php files
Two files need to be created on the server. These are the configure.php files that identify the settings of your particular server and the location of the files that you just loaded. After they have been created, you will then need to change the permissions on these files.

NOTE: Changing permissions can be done via your FTP program with the chmod feature. Usually clicking right on a directory or filename will open a menu with this option (perhaps under "Properties")

On the server locate the file: /catalog/includes/dist-configure.php
Rename this file to configure.php and change the permissions to 777 (read-write-execute for all)

Next, on the server locate the file: /catalog/admin/includes/dist-configure.php
Rename this file to configure.php and change the permissions to 777 (read-write-execute for all)



NOTE FOR IIS USERS: If you are using IIS for Windows hosting, the "chmod 777" idea for permissions settings is likely foreign to you. In IIS, under Windows, you need to right-click on the file (or folders in the next section below), and choose Properties. Then under the Security tab, ensure that the"Internet Guest Account", identified usually as: MACHINE_NAME\IUSR_MACHINE_NAME ... has at least "read" and "write" privileges... likely best to give "modify" as well. This should be done on each file/folder indicated. (If the IUSR_MACHINE_NAME account isn't listed, click "Add" and add that account from the list, and then set the required permissions.) (Note: "_MACHINE_NAME" above refers to the "machine name" or "computer name" configured by the server administrator to "name" the server.)
Set Permissions on folders
When you upload files to your server, the server will automatically set certain default permissions on those files and folders. Typically folders are set to 755 and files are set to 644. Most servers use these values. Yours may or may not.

Some folders and files need special "writable" permissions for use in Zen Cart. "Writable" typically requires 777 permission. (Your hosting company may only allow 755 as writable, and using 777 may cause blank screens when accessing your site. In that case, use 755. Ask your hosting company for direction.)

As such, you need to change the permissions on the following directories to 777 (read/write/execute). If your program allows you to set these permissions "recursively", choose that option.
• /catalog/cache
• /catalog/images
• /catalog/includes/languages/english/html_includes
• /catalog/media
• /catalog/pub
• /catalog/admin/backups
• /catalog/admin/images/graphs

Note: open the catalog/images directory and change all of the subdirectories and their subdirectories to 777 as well. For example (this is a partial list):
• /catalog/images/attributes
• /catalog/images/banners
• /catalog/images/categories
• /catalog/images/large
• /catalog/images/large/dvd
• /catalog/images/manufacturers
• /catalog/images/medium
• /catalog/images/upload

NOTE: If you miss any of the images directories and subdirectories inside /images and try to use them later, you will get an error message that you cannot write to these directories.

As for other files, they can be CHMOD 644, or 444, depending on your webserver configuration. Folders don't usually get set below 755.
Before Running the Installer
The installer is fairly intelligent and should be able to automatically supply answers to the questions listed below.

You will, however, need to confirm that the auto-detected answers are, in fact, correct as on some servers they may differ.

You will need the following information for the installation:
• The physical path to your new Zen Cart™ directory
Example: /home/myusername/public_html/catalog
• The Virtual HTTP Path (the URL to your domain and directory for your shop)
Example: http://www.mydomain.com/catalog
• The Virtual HTTPS Server (the secure URL to your domain)
Example: https://www.mydomain.com
Note: if you have a shared certificate on a virtual server this may look like:
https://mydomain.secureservername.net/
- or - https://secure.sharedservername.net/~username
• The Virtual HTTPS Path (the secure URL to your domain and directory for your shop)
Example: https://www.mydomain.com/catalog
- or - https://secure.sharedservername.net/~username/catalog
Starting the Installer
In your browser, enter the URL to your new shop, and the Installer should automatically start.
Example: http://www.mydomain.com/catalog
- or - to start the installer directly, use: http://www.mydomain.com/catalog/zc_install

If you now see a list of filenames and directories, you should speak to your Hosting Site about how to setup your server to auto-detect PHP filename extensions.
Welcome
You will be presented with a "Welcome to Zen Cart™" page, explaining the features of Zen Cart™.
License
Clicking on Continue takes you to the license screen where you are asked to read and confirm acceptance of the GPL licensing agreement.
System Inspection
Next, it will examine your server for compliance with technical requirements for running Zen Cart™, presenting you with several items you may need or want to address with your host. Anything marked in red or with an "X" must be addressed before the installer can continue. Things marked with an orange or yellow "caution" symbol are simply warnings that may or may not apply to your setup now. The image folders and others as described earlier in this document are also noted. If you make changes to your server, you can click Re-Check or press F5 in your browser to refresh the display and reflect the changes you've made before proceeding.

If a previous version of Zen Cart™ is found on your server, the installer will attempt to determine the database patch level and display that on the screen as well. In this case, an "upgrade" button will display at the bottom of the screen offering you the ability to upgrade if needed. See the upgrade instructions.

Once you are satisfied that the "pre-flight-check" inspection is OK for your needs (ideally, all green check-marks), you may click the "Install" button at the bottom of the screen.
System Setup
On the System Setup page you will need to complete the information we described in "Before Running the Installer" earlier in this document.

Indicate if you want to Enable SSL (the secure pages where required, in Login, Checkout, and optionally Admin areas) on your server. If you do not have an SSL certificate yet, do not enable this feature now.It can be changed at a later date. (See the related FAQ here for detailed instructions).

Note: If you receive any of the following error messages, go through the above steps to make sure you have not left anything out. All error messages have context-sensitive help via a popup window if you click on the more info... links supplied:
Warning: Problems Found
• /includes/configure.php does not exist. more info...
• /admin/includes/configure.php does not exist. more info...
phpBB Setup (this screen may not be shown)
Next, you will be prompted for phpBB path information. If you have the phpBB forum software already installed on your site, you may enable it for connectivity and synchronization from Zen Cart™. To enable it, specify the path on your server where the phpBB files are located. For example, if they are in ......public_html/forums then you would enter /forums in the Zen Cart™ installer for path to phpBB files.
Database Setup
On the next screen, you are asked for Database Information about your MySQL database, username and password. These can be obtained from your cPanel or equivalent control screen provided by your host. If you do not have a clean MySQL database setup with a username and password, you will need to create one.
Contact your Hosting site if you need assistance in creating a MySQL database table and/or username and password. Note that you need to have your database and userID created before the Zen Cart™ installer can continue past this screen.

Other information on this screen:
• At this time, MySQL is the primary operational database type.
Future releases may support other database types.
• We recommend that you store your Database Sessions in your database for security purposes.
Store Setup
Now, complete the Store Information about your Shop.

Note: except for "demo data", all of the information here can be (re)configured later in the Admin area of your shop.
Demo Data
If you would like to install the demo data, select yes.

We recommend that you install the demo data to familiarize yourself with many of the examples created that explain and demonstrate the vast number of features available in Zen Cart™.

You may also decide later to set up a test site with the demo data AND a separate working site for your live data so that you have the ability to refer back to the demo data for help and to see examples of a feature. This is an excellent way to learn how things work, and then try your hand at setting up your own site and testing to be sure you've done things right. Later on it can be used to help you test an upgrade or test new features you're working on before affecting your live site.


After you click Save Store Settings, there will be some hesitation as the database tables are created and the demo data is optionally loaded. You will see some progress indicators as the database is loaded.
Admin Setup
Now, complete the Admin Information to set your Login name, Admin email address and password.

NOTE: both the login name and password are case sensitive.

Save the Admin settings and your installation is now complete!

Providing there were no errors during installation, you should be able to now enter the Admin or the Catalog.
After Installation
a) RENAME YOUR ADMIN FOLDER. Instructions here.

b) When you enter the Catalog, you will receive security warnings about the configure.php files and the /zc_install directory.

configure.php files
You will now want to change the permissions on the configure.php files with chmod 644 (or 444 depending on your server...and sometimes setting 444 cannot be done via FTP, in which case use your host's control panel or file manager to set the permissions level.)

These are located here (remember, "catalog" is what we used as an example here -- your site may or may not include "catalog" as a folder name):
/catalog/includes/configure.php
/catalog/admin/includes/configure.php

It would also be a good idea to download a copy of these files to your computer from the server as they have been setup and configured to your server specifications based on the Installation process.

If you have any errors or problems, most of these can be corrected by minor adjustments to these two files.

c) Remove the zc_install directory
Next, you will want to delete the /catalog/zc_install directory

(If you are only testing and plan to install again, you could rename the folder to something like: /catalog/zc_install_complete until you take your site live. NOTE: use a different name than zc_install_complete as some hacker may try using it, having read this help file. Do NOT leave a zc_install folder on the server of a live site....for security reasons.)

How to play php movies on imac?

I have archived movies on a USB drive while using my PC. I'm a bit new to figuring out the video files so bear with me. So I plug the USB drive into my iMac and I see my directories and movies. When I open the actual movie folder, I see multiple files, a row of dark grey boxes that say "exec" on them and under them VIDEO_TS.BUP, VIDEO_TS.IFO, VTS_01.BUP, VTS_01_0.IFO.

Under that row I find several files with a different icon, and VTS_01_1.VOB, and in this case there are five (5) of these VOB files, each numbered sequentially so the last one is VTS_01_5.VOB.

I have a AppleTV (Gen1/40Gig internal drive), and what I want to do is set up my external USB drive as the source, and then use the ATV to stream my movies, by-passing the internal drive. I'll get some Apple help on that, but what I want to know is what the above files are, and how to play a movie direct from the files start to finish?

Any help would be greatly appreciated!!!

how to make in php xml configuration files ?


As a general rule, when you develop any reasonably-complex piece of software, it's a good idea to take time to identify the product's key configuration variables, and then separate these from the standard variable namespace and place them in a separate area. With this process, you can create a centralized repository of application configuration information and simplify the task of modifying the product to work in different environment. It can also help increase a developer's familiarity with, and understanding of, the key pieces of information needed to get the product up and running.
Please see the link : http://www.ibm.com/developerworks/library/x-xjconf/#c2

how to php code in img ?

This part of my script displays categories from mysql database:

0) { // Show if recordset not empty ?>



Sorry, there are currently no categories available.



I would like to display a jpeg with the same name as the category so I changed bolded parts of my script to:

''

How to password protect page php linux ?

you can see a pop up which ask for entering user name and password for login. Well in my article I’m going to show you how you can build the same kind of page protecting mechanism using http authentication in PHP.

Somebody might say that I can also protect the page by making a login page to access the protected page. Well dude!! you are right, you can do that but the main benefits of this method is “you don’t have to create the login page at all”.
Let’s Start, First of all store the user name and password in the variables
$auth_user=”urusername”;
$auth_pwd=”urpassword”;
For better security, please store these values in database and authenticate from database.
Now let’s create the http authentication function called authenticate() using header() function available in PHP.
function authenticate()
{
header(‘WWW-Authenticate: Basic realm=”Enter Your Login detail to add money”‘);
header(‘HTTP/1.0 401 Unauthorized’);
echo “You must enter a valid login ID and password to access this resource\n”;
exit;
}
The first line of the function tell browser to open the pop up box to enter user name and password the “realm” element contains the string to be displayed in the pop up box.
And the other two lines are called only when user hits the cancel button of the pop up.
Now let’s start the code of authentication.
if ($_SERVER['PHP_AUTH_USER']==$auth_user && $_SERVER['PHP_AUTH_PW']==$auth_pwd && $_SESSION['authorized']==1)
{
echo “Your are logged in”;
}
else
{
$_SESSION['authorized']=1;
authenticate();
}
As you can see in the if statement there are two variables $_SERVER['PHP_AUTH_USER'] and $_SERVER['PHP_AUTH_PW'], these are the two values which comes from the user name and password field of pop up and these two are the predefined variables of PHP.
I’ve also used the $_SESSION variable to ensure that the pop up box is displayed at least once in the page since the the else condition is executed first when the page is loaded.
Thats’a all dude, now your page is protected with user name and password but without need to built a login page.

Saturday, March 5, 2011

Which are the file required or use for android application?


List of Files for an Android Application
The following list describes the structure and files of an Android application. Many of these files can be built for you (or stubbed out) by the android tool shipped in the tools/ menu of the SDK.


MyApp/

    AndroidManifest.xml
(required) Advertises the screens that this application provides, where they can be launched (from the main program menu or elsewhere), any content providers it implements and what kind of data they handle, where the implementation classes are, and other application-wide information. Syntax details for this file are described in The AndroidManifest.xml File.
    src/
        /myPackagePath/.../MyClass.java
(required) This folder holds all the source code files for your application, inside the appropriate package subfolders.
    res/
(required) This folder holds all the resources for your application. Resources are external data files or description files that are compiled into your code at build time. Files in different folders are compiled differently, so you must put the proper resource into the proper folder. (See Resources for details.)
        anim/
               animation1.xml
                        ...
(optional) Holds any animation XML description files that the application uses. The format of these files is described in Resources.
        drawable/
                      some_picture.png
                      some_stretchable.9.png
                      some_background.xml
                                    ...
(optional) Zero or more files that will be compiled to android.graphics.drawable resources. Files can be image files (png, gif, or other) or XML files describing other graphics such as bitmaps, stretchable bitmaps, or gradients. Supported bitmap file formats are PNG (preferred), JPG, and GIF (discouraged), as well as the custom 9-patch stretchable bitmap format. These formats are described in Resources.
        layout/
                      screen_1_layout.xml
                                 ...
(optional) Holds all the XML files describing screens or parts of screens. Although you could create a screen in Java, defining them in XML files is typically easier. A layout file is similar in concept to an HTML file that describes the screen layout and components. See User Interface for more information about designing screens, and Available Resource Types for the syntax of these files.
        values/
                      arrays
                      classes.xml
                      colors.xml
                      dimens.xml
                      strings.xml
                      styles.xml
                      values.xml
(optional) XML files describing additional resources such as strings, colors, and styles. The naming, quantity, and number of these files are not enforced--any XML file is compiled, but these are the standard names given to these files. However, the syntax of these files is prescribed by Android, and described in Resources.
        xml/
(optional) XML files that can be read at run time on the device.
        raw/
(optional) Any files to be copied directly to the device.

Php for android instllation


PhpForAndroid.apk requires ASE r26. However, r26 hasn't been released yet (latest is r25) so we provide an unofficial ASE build by now. Please, don't tell ASE folks about bugs related to this build. Contact us instead or build your own ASE from trunk to discard an already addressed issue. 


Don't have barcode reader? Click here.
Download our unofficial ASE build
ASE only comes with a shell interpreter by default.

Install PhpForAndroid.apk

Don't have barcode reader? Click here.Download latest release (Releases page)Once installed, run it and tap on “Install”.The PHP binary and the scripts will become available to ASE.Now!, run ASE. You should be able to see PHP demo scripts and they should work!.Doesn't it work? Please, try uninstalling and installing again (this is alpha software).Still not working? Fill this survey please: http://www.zoomerang.com/Survey/WEB22AXDHRY8L5



Getting started

ASE ApiReference is your friend : http://code.google.com/p/android-scripting/wiki/ApiReference

The real time ways (no more install, no SDK, nothing required)

1. Add/Edit PHP scripts on your mobile

ASE allows you to add or edit scripts on your mobile.

2. Use testnow.php

“allow_url_include” is On by default so you can include your code easily.
Include your own internet publicly available script. You'll find an already installed php script called “test.php”:
require_once("Android.php");
include("http://phpforandroid.net/files/testnow.php.txt"); // ".txt"
extention required to prevent parsing
 
And video tutorial for  PHPforAndroid.apk  HOW TO  install and test
  
http://vimeo.com/13177370
 

How to modify php settings in xampp ?

XAMPP is an easy to install Apache distribution containing MySQL, PHP and Perl. XAMPP is really very easy to install and to use - just download, extract and start.

XAMPP Supported Platforms

a version for Linux systems (tested for Ubuntu, SuSE, RedHat, Mandrake and Debian),

a version for Windows 98, NT, 2000, 2003 and XP,

a beta version for Solaris SPARC (developed and tested under Solaris 8),
and a beta version for MacOS X.

This MacOSX and Solaris versions of XAMPP are still in the first steps of development. Use at you own risk!
http://www.debianhelp.co.uk/xampp.htm

How to make a contact us form in dreamweaver using php ?

you will learn how to create your all important Dreamweaver Contact Form and have the details of the form emailed straight to your INBOX. Capturing Contact Information of potential customers in extremely important in the business world. Don’t let those potential customers or clients disappear just because you didn’t have a Contact Form on your website. By following this Dreamweaver Tutorial you will have a WORKING Contact Form up and running in a few easy steps.
Now you are ready to begin inserting the form and the fields you would like onto the page. In this example I am going to create anew page, but you can easily add this to an existing page if you already have one in mind for the form to be placed on.
1. In Dreamweaver, choose File > New The New Document Dialog Box appears.
2. In the Blank Document list, choose HTML, then click Create to create a new HTML document.
3. In the Title text field in the Document toolbar, enter Contact Form to add a title to your document.
4. Choose File > Save, then save the document in your local site folder. Name it ContactForm.htm.
5. Next we are going to Insert a Form onto the page, Choose Insert > Form then Form from the Flyout Menu. A Form dialog box will then open. In the Action text box type in FormtoEmail.php (this is the file you extracted to the root of your website earlier). Change the Method to POST and then in the NAME text box type in ContactForm.

6. Next step is to place the form objects onto the page (the information we would like to collect). In this example I have placed a text box for Name and Email Address, and also a Text Area for Comments. To do this click inside your form object and then from the top menu select Insert > Form > Label. From the Code Window click in between the LABEL Tags and type in Name:. Next from the toip menu again select Insert > Form > Text Field. Name the Text field name from the properties box at the bottom.
Repeat those steps and add another Label and Text Field and name it email.
7. Add another Label and type in Comments. Then add a Text Area, go to Inset > Form > Text Area in the top menu. Name the Text Area comments from the Properties box at the bottom and give the Character Width a value of 50 and the Number of Lines a value of 10.
8. Add a Button. Again from the top menu Insert > Form > Button. Your Form should now look like this: (note I have put each element on a different line to help with the usability).
9. Now we need to edit a couple of lines in the FormtoEmail.php file. Open the file in Dreamweaver. The first line you need to edit is the line that starts with $my_email.
Change the email address to the address you want the emails to be sent to. The other line that you may wish to change is this one:

This is where the visitor will be directed after they have pressed the SUBMIT button. If you have a page that you like to direct them to then place the location of the file in there, or simply leave it blank and they will get a thank you message on the same page.
10. Upload both files to your web server and bingo all done. You should know have a working contact form.
In an upcoming Tutorial I am going to show you how to use Dreamweaver and CSS (Cascading Style Sheets) to jazz up your forms with a bit of style!

how to make a chat server in php ?

Here you will get instructions on how to create and run a chat engine on your website, using a server-side programming language. This article assumes you have substantial technological knowledge.
1 Install a server-side language such as PHP or ASP if you need to.
2
Create a database table with fields to store a nickname, time and message.
3
Create a user interface with 2 text boxes - one for entering a chat message and other for displaying the chat log.
4
Create the client-side script using Javascript and AJAX techniques. The script should do the following things:
o Use AJAX to transfer chat messages one wishes to send to the server.
o Periodically check the server for new messages and add them to the chat window. It needs to send the time of the last message received.

5
Create the server-side script. It should do as follows:
o Add incoming messages to the database table with the nickname of the person that said it and the time stamp.
o Return new messages it has received after the time specified in the aforementioned AJAX request.
edit Tips
• Using an AJAX library might be helpful. A lot of AJAX libraries are available for download. One of these is AjaxLib
• Clear the database once the chat is over so that you can save on disk space used for the database.

how to get php to find and display data from mysql database ?

PHP, MySQL and a Web Server capable of parsing PHP pages, like Apache or IIS. This search script does not spider all your pages by crawling the links, so the content you want to be searchable must be within the database. Knowledge of PHP and MySQL is also necessary because this script is just the bones of a working solution. Numerous edits must take place upon this script before it is a usable solution.
Lets get started. If you would rather not copy the code into a text editor
Just after the body tag of your page, place the following HTML. This is for the form which will contain the textfield to enter our search string in.
form name="form" action="search.php" method="get"
input type="text" name="q"
input type="submit" name="Submit" value="Search" form
Now, enter the following PHP. Follow the PHP comments for what the script is doing, if you get stuck,
=1) { // bypass PREV link if s is 0
$prevs=($s-$limit);
print " <<
Prev 10
  ";
}

// calculate number of pages needing links
$pages=intval($numrows/$limit);

// $pages now contains int of pages needed unless there is a remainder from division

if ($numrows%$limit) {
// has remainder so add one page
$pages++;
}

// check to see if last page
if (!((($s+$limit)/$limit)==$pages) && $pages!=1) {

// not last page so give NEXT link
$news=$s+$limit;

echo " a href=\"$PHP_SELF?s=$news&q=$var\" Next 10 >> a";
}

$a = $s + ($limit) ;
if ($a > $numrows) { $a = $numrows ; }
$b = $s + 1 ;
echo " p Showing results $b to $a of $numrows p";

?>
Three major areas are covered in this script, the first is selecting data from the database which matches your entered keyword, the second is displaying the results on the web page and the last is generating the paging, which displays results in chunks of 10 with next/previous links where they are necessary.
Important: This script requires numerous edits before it can be adapted for use. The SQL query in this example is only selecting 1 field from a hypothetical database which doesn't pre-exist, nor is included in the downloadable files. Further down the script, the value of that field is being displayed on the page. The major amendments that need to be performed are 1.) The SQL statement, and 2.) The PHP which displays the result

how to edit a php website ?

very Web developer has to know the building blocks of the Web site editing using some html page,css stylesheet and more:
• HTML 4.01
• CSS
• XHTML
• XML and XSLT
• JavaScript
• ASP or PHP
• Managing data with SQL
• The future of the Web
________________________________________
HTML 4.01
HTML is the language of the Web, and every Web developer should have a basic understanding of it.
HTML 4.01 is an important Web standard, and very different from HTML 3.2.
When tags, like font and color attributes, were added to HTML 3.2, it started a developer's nightmare. Development of web sites where font information must be added to every single Web page is a long and expensive job.
With HTML 4.01, all formatting can be moved out of the HTML document, and into a separate style sheet.
SS - Cascading Style Sheets
Styles define how HTML elements should be displayed, just like the tag in HTML 3.2.
Style sheets are normally saved in external files. External style sheets enable you to change the appearance and layout of EVERY page in your Web site, just by editing a single document. If you have ever tried changing something like the font or color of all the headings in all your HTML pages, you will understand how CSS can save a lot of work!
XHTML
XHTML stands for Extensible HyperText Markup Language.
XHTML is a reformulation of HTML 4.01 in XML, and is supported in all major
XML - A Tool for Describing Data
XML is NOT a replacement for HTML. XML describes data, while HTML displays the data.
XML is as a cross-platform, software-, and hardware-independent tool for storing and transmitting information.
We believe that XML is as important to the Web as HTML was to the foundation of the Web, and that XML will be the most common tool for all data manipulation and data transmission.
XSLT - A Tool for Transforming Data
XSLT is used to transform XML documents into other formats, like HTML, WML, etc.
XSLT can transform an XML file into a format that is recognized by a browser.
XSLT can also add HTML elements, rearrange and sort data, make decisions about which data to display, and more.
JavaScript - Client-Side Scripting
Client-side scripting is about "programming" the behavior of a browser.
To deliver more dynamic web content, you should teach yourself JavaScript.
• JavaScript gives HTML designers a programming tool
• JavaScript can put dynamic text into an HTML page
• JavaScript can react to events
• JavaScript can change HTML elements
• JavaScript can be used to validate data
ASP or PHP - Server-Side Scripting
Server-side scripting is about "programming" an Internet server.
To deliver more dynamic web content, you should teach yourself server-side scripting.
With server-side scripting, you can:
• Dynamically edit, change, or add any content of a Web page
• Respond to user queries and form data
• Access databases and return the result to a browser
• Access files and return the result to a browser
• Transform XML data to HTML data and return the results to a browser
• Customize a Web page to make it more useful for individual users
• Provide security and access control to Web pages
• Tailor your output to different types of browsers
• Minimize network traffic
Managing Data with SQL
SQL is the standard language for accessing and manipulating databases.
SQL is used to access and manipulate data in MySQL, SQL Server, MS Access, Oracle, Sybase, DB2, and other database systems.
Knowledge of SQL is a must for anyone wanting to store or retrieve data from a database.

What Will the Future Bring?
One important thing to know is that the functionality of Web Sites will change very drastically. We will see a huge shift from sites displaying "static content" to data driven sites delivering "dynamic content".
We will also see new browsers, like the browsers found in mobile devices. We will also see more use of XML for transmitting data between servers, or between servers and browsers.

Friday, March 4, 2011

how to create a php blog ?

the login script with the blog should not be a problem for you. In fact all it needs to do is send a user through, if his or her login is valid, and then log the user out. The blog will have a MySQL backend that will store all the articles and related replies.
It will also have a categories table that we will use to store all the different categories in. The categories will help us group the articles together that belong to the same category. This will be achieved by adding a "categoryID" foreign key to the article table.
To retrieve the articles we will mostly use joins in our SQL, as this is the best way to retrieve grouped information, which in our case is absolutely vital to the way the blog structures the articles. We will also retrieve the most recent topics and display them on the side bars for easy access. This will act as a shortcut for the user, when he or she wants a quick view of what the latest messages are about.
The index page sends two values over to the comments page. These values represent the categoryID and the article ID. They will be used to retrieve the article and its replies on the comments page; they will also be used to retrieve the category names, which are related to those articles.
Creating the Blog Script for a PHP/MySQL Blogging System - The Database Tables

CREATE TABLE `article` (
`artid` int(5) NOT NULL auto_increment,
`name` varchar(255) NOT NULL default '',
`title` varchar(255) NOT NULL default '',
`comments` text NOT NULL,
`date_posted` date NOT NULL default '0000-00-00',
`categoryID` int(4) NOT NULL default '0',
`artchild` int(5) NOT NULL default '0',
PRIMARY KEY (`artid`)
) TYPE=MyISAM AUTO_INCREMENT=30 ;
Most of the fields in the table should be self explanatory, except perhaps the "artchild" column. The artchild column will hold the message ID of a message that users reply to. This is how it works: the first time a article is written, its artchild value will be “0” and it will have an automatically created number. When a response is created to this article the new response article’s artchild will have the auto number value added to its artchild column.
So for example if we wanted to retrieve all the articles related to a certain topic, say topic number eight, then all we need to do is retrieve all articles that have an "artchild" value of eight. The categoryID is the foreign key. It represents the ID of the category name in the category table, which we have not yet talked about. That is presented in the code below:
Categories tbl:
CREATE TABLE `categories` (
`catid` int(5) NOT NULL auto_increment,
`category` varchar(255) NOT NULL default '',
PRIMARY KEY (`catid`)
) TYPE=MyISAM AUTO_INCREMENT=3 ;
This table will hold the category names of the topics that will be used in the blog. The categories will be managed by the administrator in the admin section of the blog.
The Blog
The blog itself will really have only two pages. The index.php page will show a list of all the main topics in the database. The comments.php page will enable you to view comments made to a particular message, and also give you the chance to comment on the article. There will be an additional page, functions.php, which will hold all the functions used in the blog.
The blog will only allow the administrator to introduce new discussions. The actual users will only be able to comment on those discussions. This is because a blog by its very nature is like a web based personal diary, and as with any other diary you don’t let other people write in it unless you personally want them to.
Creating the Blog Script for a PHP/MySQL Blogging System - index.php
(Page 3 of 4 )
When the "index.php" is loaded the following SQL is executed:

In this SQL the articles are retrieved together with the categories to which they belong. The inner join does the job of linking the articles with their categories. The DATE_SUB() function does the job of retrieving all the messages posted in the last thirty days.
I set the condition of "artchild=0" because any article whose "artchild" value is greater then zero is a reply. All replies have the same title as the main article to which it is replying. By putting a condition of “0” in the SQL, I only retrieve the main topics. You will be able to view comments made to these topics by clicking on a link called comments, which is displayed with each topic.
To work out whether comments have been made on an article, we run the following SQL:
$getcomments = "SELECT * FROM article WHERE
artchild='".$row_articles['artid']."'";
if(!$theResult=mysql_query($getcomments)){
echo mysql_error();
}else{
$num_comments=mysql_num_rows($theResult);
echo $num_comments;
}
The ‘".$row_articles['artid']."’ refers to the article ID retrieved from "$query1." Then we just count the number of rows returned as in the line "$num_comments=mysql_num_rows($theResult);" and display that number.
If you look towards the right in the screen shot below, you will notice a list of topics displayed. This is achieved by the following SQL:
$query="Select *,COUNT(*) FROM article INNER JOIN categories ON
categoryID=catid WHERE DATE_SUB(CURDATE(),INTERVAL 30 DAY) GROUP
BY title DESC LIMIT 10 ";
$blog = mysql_query($query) or die(mysql_error());
$num_blog = mysql_num_rows($blog);
Again this SQL just retrieves the articles from the database and joins the category information on the articles. We need the category info because we are going to show the title of the articles and in what category they were posted.

how to create a link using php ?

Creating a link with PHP uses the same code as it dose in HTML. Depending on where we are getting our information, and where in our file it is we might present this HTML in a slightly different way.
If you are making a link in a PHP document, that is outside of the PHP brackets, you just use HTML. Here is an example:
a href=https://twitter.com/angela_bradley My Twitter a


If the link needs to be inside of the PHP you have two options. Option one is to end the PHP and then reopen it. Here is an example:

a href="https://twitter.com/angela_bradley"My Twitter a


The other option is to print or echo the HTML code inside of the PHP. Here is an example:
My Twitter"
?>

Another thing we can do is create a link from a variable. Let's say that the variable $url holds the URL for a website that someone has submitted, or that we have pulled from a database. We can use the variable in our HTML.
a href=https://twitter.com/angela_bradley My Twitter a
$site_title a"
?>

how to create a go back in php ?


If you have an html page that includes php
(and your server is configured to parse .html as php, then:


html
headtitle...titlehead
body
?php echo "Hello World!"; ?
body
html

if you mean executing a php script, and then redirecting, then its
something like this:

** php script*
if (TRUE == $jump) {
 yes yes, lets be complient
header("Location: http:www.somewhere.compage.html");
}

** html page **
html
headtitle...titlehead
body
h1Hello worldh1
pyou were redirected from phpp
body
html