phpyellowtm developer guideCustomizeThis page contains information or links to the following:
Changing Open Source CodephpYellow has unencrypted open source code written in text format. You may change the code to suit yourself (subject to the license). When changing open source code:
Non-invasive HTML editors
A few popular HTML editors - which previously included Microsoft Frontpage and
Macromedia Dreamweaver - changed the source code on every page loaded. The change
could be minimal, for example adding line breaks, non-breaking spaces or non visible output.
However the result of an invasive change can be and frequently is the failure
of php scripts to run. If your scripts fail to work then this is an issue. The solution is
to use a non-invasive HTML editor - or to use the options within your editor to turn
non-invasive mode on.
What HTML editor can be used?
You may also browse http://www.download.com and find other good html editors. ConstantsTo customize the constants on util.php will make the most initial dramatic change to your directory. Constants like YOURPHPYELLOWNAME, your BENEFIT and other highly visible data may be changed in util.php CSS - Cascasding Style sheet - yellow.cssMake directory wide changes to html tags using a css editor like TopStyle. Tags like <h1>, <p>, <ul>, <table>, <td> and many others are easily changed across all pages using just a css editor and just one main file - yellow.css. You may also create your own .class styles. A Netscape .css file is also included and will be offered to Netscape users. Expect over 80% of your visitors to view your pages in a recent Internet Explorer browser. Front pageIt is common to customize the front page. Open up index.php and modify to suit. Make sure your editor opens php files in "non-invasive" mode. Any other mode may change your php code and cause the application to fail. In such cases the normal remedy is to replace the file and start afresh. Search TypeBrowse search.php to see available search types. At last count there were six different searches you could use in the Pro Edition. Search Default
The default search is set in util.php
Combine two or more search typesYou may also build your own search default by combining two or more search types. Open searchDefault.php in an editor to view more help about changing the default search. Refer back to the search.php page for examples.Change the data shownWhen search results are shown certain data is shown. You can change the data shown.
Edit proListing*.phpAll data in the database is available. You decide what data to display by modifying the look and feel of these files:
Following are the variable names to use when changing the data shown:
Example: to display the firstname and lastname fields:
<?php echo $yffirstname . " " . $yflastname; // displays firstname, a space, and lastname ?>
Change the structure of the page layout
phpYellow is designed with a "sandwich" structural page layout like this:
new.php
yellowresult.php HOW TO DEPLOY
There is still work required of you in order to modify the structure. Hopefully the available files will make it easier. MiscellaneousFollowing are miscellaneous notes about customization:
How to change the default rank of all new listings
The default rank for listings added to your directory is the number 0. To make all new
listings start at a higher rank change the rank. You may do so by pasting this code
into EasySQL as accessed from the Administration Center:
Files Likely to Need Cosmetic ChangeThese are some of the files you may change to effect the look and feel you want:
Change the Look and Feel of each RecordPro EditionphpYellow Pages is capable of showing any combination of data [database fields] you wish. If the data is contained within the database, then the data may be displayed in a record.
Display TypeWith phpYellow Pages version 2.32 or higher you may choose to offer:
RESULTS_ON_ONE_LINE is useful for displaying a large number of records.
A few features of each record are shown on one line, with a link to
complete record detail.
Turn Off RESULTS_ON_ONE_LINEIf you do not wish to offer RESULTS_ON_ONE_LINE - you only want to offer Complete detail - then:
define ("RESULTS_ON_ONE_LINE", "" ); // no value exists between the double quotes, it is empty. Add, remove or modify the data shown with RESULTS_ON_ONE_LINETo change WHAT data [database fields] are displayed with RESULTS_ON_ONE_LINE:
Change Data Shown with Complete Record DisplayphpYellow Pages can show different data based on the rank of any listing. Default display is provided for the various ranks. Login and refer to the phpyellow Client Control Panel for a description of the listing types.showOneRecord.php controls listing templates for each listing type. Lite EditionThe Lite Edition does not recognize and does not use ranks for listings in searches. Accordingly, one file is used to show results for user initiated searches - oneRecord.php. This file can be modified to suit your taste. Using plain HTML or php you can show data or rearrange the look, or change color or font-size or font-family ... basically any change you want to make. Preferred Customization MethodsIt is preferable to make as many changes as possible using an external .css style sheet. By making changes to the external style sheet you keep your content separate from the formatting (font, color, position and so on...). This in turn allows you to:
The more changes you make to the original php files the more work you are creating for yourself in the long term. Do yourself a favor and keep the content separate from the formatting - by learning how to use cascading style sheets. The Web Developer's Virtual Library has excellent resources for you to learn CSS styles. Using ImagesImages are used in the Pro Edition only. Image use and operation may also be changed by the phpyellow site administrator. The following descriptions are for any phpyellow Pro Edition 3.x or higher, and are based on default settings. Three images may be shown with any one listing. The company logo, and two product or service images. COMPANY LOGOOne image is called the 'company logo' and is associated with the company. Anytime the company information is displayed the 'company logo' can be displayed, if the logo is uploaded by the user and if the phpyellow site administrator has allowed logos in util.php configuration.By default the logo will NOT be displayed in results unless paid for, although the administrator has the capability to change this logic. Restrictions on dimension and file size The administrator may place and modify the built in restrictions on dimension of the logo, and total file size uploaded, by modifying util.php TWO PRODUCT OR SERVICE IMAGESIn addition to the logo, two product or service images - category images - may be shown. These images are associated with a specific ckey #. The images are shown only when the related category listing is shown. There are no restrictions on dimension or file size for these images.HOW TO CHANGE PLACEMENT OF IMAGESThe placement of an image - where it appears on the listing - may be changed by modifying the file which displays it. Change one or all of:a) proListingBasic.php // by default this does NOT show any images b) proListingFeatured.php // shows 'TopPick' image c) proListingPremium.php // shows logo and category images d) proListingSponsor.php // shows logo and category images You may move the location of - or entirely remove the logo or images - from these pages. W3C Cascading Style SheetsphpYellow Pages is compliant with the W3C's HTML 4.0, which since 1997 has been recommending that you keep structure apart from formatting. For example, in a Heading 1 tag colored red, the heading tags will be in the html document, and the color for the heading will be in an external .css file. This makes it easy to make sitewide changes in formatting to every page, but at the cost of a learning curve for .css - well worth it! You may find .css tutorials online and contained within better html editors. Netscape Display OptimizationNetscape users will be familiar with display dysfunctionality in Netscape, especially in regard to W3C cascading style sheets. Netscape 6 (and higher versions) do a tolerable job in supporting Level 1 CSS. Most (if not all) of phpYellow Pages only uses CSS Level 1, and most phpYellow Pages should display tolerably well in Netscape 6 or higher. How to Optimize for Other Netscape BrowsersThe formatting for phpYellow Pages is driven with external cascading style sheets. There is also browser detection. When a user loads any page a javascript detects their browser and loads a .css file for that specific browser make. To change the look and feel for Netscape simply open netscape.css in any css editor and format this file to suit your tastes. You can have a totally different look and feel for Netscape visitors - and another for Internet Explorer visitors. You can add more browser types by adding another case statement block and a related css file in the yellow.js script. Based on an analysis of website traffic most surfers use recent browser versions. You can add specific versioning if you want but the traffic that will use it will tend to be negligible. Use Your Own CategoriesOne of the ways to customize phpYellow is to make changes to the category values. For example, instead of offering a generic Yellow Page service, you may change all the category values to the type of service you wish to have an online directory for. You may want to build a directory just for Real Estate services in your city, or create a Tourism only directory, or a High Tech services directory for your state, or an Automobile Dealer directory in your country, or ... the potential is limited only by your imagination. To make such a change will dramatically specialize your phpYellow implementation and very possibly enable you to provide a UNIQUE service not offered elsewhere. Specialized directories can be created by using the categories*.php files as found in the distribution package. To do so, change the filename containing the categories you want to "categories.php". How to Change an Individual CategoryIt's easy to customize the categories of products and services in phpYellow. Open up the file named categories.php in your html editor. Add, edit or remove one or more categories like this: ExampleReplace each select list item with the value and value displayed to the user that you want. For example, within categories.php:
<option value="Air-Conditioning">Air Conditioning</option>
Above you may change the actual value of "Air-Conditioning" to, for example, "Education". Also remember to change the words between the begin and end of the <option> tags to "Education". The value= contains the data which gets posted to the database. The other identical category word is what the user actually sees when they view the drop down list. Upload the new categories.php file to your web server and that's all you need to do - if these changes are made before you go online with your phpYellow implementation. In NO CIRCUMSTANCE should you change any php or selected code or variables when making these category option changes. Change the option values only. By making these changes you are merely altering the V A L U E S that get selected by the user and sent or searched from the database. Instead of storing generic Yellow page like values, you are storing specialized values for your particular implementation - for example all services and products relating to "Education", or "Internet Products and Services" - whatever your implementation is. Changing the values makes all the difference - everything else still works exactly the same way - it is the values that make the results different. Any developer can make these value changes by following the steps detailed above. Changing the categories within AdministrationIn Pro version 2.22 and higher you may change the category of a listing using a point and click tool. This tool is called 'Set CKEY Parameters'. The listing expiry date, category, position, payment required and status may be changed. A pop up window reports the result of your selection and automatically closes in POPUPTIMEOUT milliseconds. You may set your own value for POPUPTIMEOUT in the util.php file.
For example, you can change a category submitted by the user for their listing from "Computer Software" to "Internet Products". To do so you need to note the ckey number stamped on the listing (obtained via any search), then use the number in the 'Set CKEY Parameters' admin tool as pictured above. How to Customize SUBJURISDICTION
This feature lets you quickly identify and customize sub-regions
within your own country.
define("SUBJURISDICTION", "world"); /* modify - 'world', 'USACanada', 'USA', 'UK', 'Canada'
Determines the type of country subregion: open entry text box, a state list,
the UK county list, Canadian provinces or ... add your own case.
The result is shown in various forms that use such data. If you _add_ a
new subjurisdiction please forward the sj*.php code to us for
free inclusion in the next release. To change the existing SUBJURISDICTION
open util.php and enter your preferred value. Example: 'world', 'USACanada', 'USA', 'UK', 'Canada'
or others as shown to be available.
How to Customize Your CountriesChanging provinces or countries is similar to changing categories. Open up the provinces or countries file, make desired changes, save and upload to your web server. Modify the data fields you want to make requiredThe bare minimum requirements for any listing is email and password. If you want to make MORE data fields required then follow these steps: HOW TO MAKE DATA REQUIREDTo require certain data to be entered by the user:
Detail - Link a URL to a specific Database RecordYou can build a link to point toward a specific record. The "Detail" feature is used to do so. "Detail" selects a specific record number using the form: http://www.yourDomain.com/phpyellow/yellowresult.php?goal=Detail&ckey=1 Change ckey to the value of your record. ckey may be located by completing any search and looking for " On correspondence quote ckey# ". By default this is found in each displayed listing. You may also find it by asking the webmaster. ckey is the unique database key for the category record. For example, when you submit a listing you have a single contact table record number, called customerid. When you submit one or more category records each record has a unique number called ckey. The two tables are joined together as needed using a common id. A special script is programmed to find the ckey and display the related contact and category record on a page all by itself. How to set a specific expiration date for any listingA specific expiration date can be set by:
|