وب سایت-طریقه ساخت سایت با استفاده از CMS
مقدمه 2
ویژگیهای وب سایت دینامیک 3
تعریف مدل 4
نیازهای شرکت صنایع پایدار 16
نقشه سایت 17
برخی از کد های PHP
contact(تماس با ما) 19
statistice(آمار گیری) 26
users(کاربران) 30
search(جستجو) 40
login(ورود و خروج) 44
بانک اطلاعاتی(DataBase)
نمودار بانک اطلاعاتی ER-D 46نحوه به دست آوردن DataBase 53
فهرست منابع 54
مقدمه
سایت دینامیک به سایتی گفته می شود که شرکت بتواند مدیریت کامل بر روی سایت داشته باشد و در صورت نیاز سایت را Update نماید.
این سایت صفحات ثابت ندارد و مدیر سایت می تواند مطالب سایت را ویرایش نماید.
ویژگیهای وب سایت دینامیک
سایت پیشنهادی شامل ویژگیهایی به شرح زیر میباشد:
تعریف این مدل به شما این امکان را می دهد تا از الگو و ساختارهای مشابه که قبلا ساخته شده اند، برای:
استفاده نمود. مدلهای مشابه دارای مزیتهای ذیل خواهد بود:
باید توجه داشت که شناخت صحیح از یک نیاز و طراحی دقیق سیستم مناسب برای رفع آن نیاز، مستلزم فعالیت مستقیم مدیران در تمامی قسمتهای مختلف سیستم است .
درصورت عدم فعالیت مدیران و طراحان، حتی در یک بخش کوچک، باعث عدم شناخت از آن بخش شده و مانند یک سوراخ بسیار کوچک در یک سد بزرگ، در دراز مدت منجر به فروپاشی آن خواهد گردید.
یک CMS عموما شامل موارد زیر است:
سیستم مدیریت محتوای مبتنی بر وب، شما را قادر می سازد که:
بعضی از CMSهایی که در حال حاضر مورد استفاده کاربران می باشند، عبارتند از:
برای استفاده از CMSها در کامپیوتر PC باید از سرورهای local استفاده نمود. یکی از برنامه های سروربسته نرم افزاری EasyPHP می باشد. این بسته نرم افزاری شامل نرم افزار های زیر می باشد:
کاربران باید بعد از نصب برنامه EasyPHP یکی از CMSهای نام برده در بالا را بنا بر نیاز، بر روی این سرور خانگی نصب کنند.
همانطور که گفته شد بعد از نصب EasyPHP نیاز به یک CMS داریم که ما از Mambo استفاده می کنیم.
طریقه ساخت سایت با استفاده از CMS
جهت ساخت یک سایت از برنامه EasyPHP کمک می گیریم و چون می خواهیم از CMS ها استفاده کنیم می بایست 4 گام اساسی را طی کنیم. پیش از آن باید یکی از CMS ها که می خواهیم با آن کار کنیم را داخل شاخه (Root)www کپی کنیم سپس داخل Browser صفحه Internet explorer آدرس Localhost را می نویسیم.(http://127.0.0.1/) در EasyPHP صفحه وب محلی را می توان به دو صورت مشاهده کرد: localhost و یا 127.0.0.1 .
شکل 1-1
در این صفحه فولدرهای شاخه Root را می بینیم.
ما از Mambo استفاده می کنیم. جهت راه اندازی آن می بایست به شرح ذیل عمل کنیم:
شکل2-1
شکل 3-1
شکل 4-1
شکل 5-1
شکل6-1
شکل7-1
شکل8-1
نیازهای شرکت صنایع پایدار
این سایت باید مطالب زیر را در خود بگنجاند:
نقشه سایت
مشخصات پکینگ ها
شامل مشخصات فنی قطره گیرها
برخی از کد های PHP
طراحی یک سایت با استفاده از CMS ها نیازی به کد نویسی ندارد، چرا که این کار از پیش تعریف شده است و فقط در صورت اشتباه بودن کدنیاز به اصلاح آن داریم.
کدهایPHP کدهای پردازشی می باشند و باید میان تگهای HTML استفاده شوند.
در اینجا برخی از کدها را مشاهده می کنیم.
/**
* @version $Id: admin.admin.php,v 1.1 2005/07/22 01:51:58 eddieajau Exp $
* @package Mambo
* @subpackage Admin
* @copyright (C) 2000 - 2005 Miro International Pty Ltd
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
* Mambo is Free Software
*/
/** ensure this file is being included by a parent file */
defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
require_once( $mainframe->getPath( 'admin_html' ) );
switch ($task) {
case 'redirect':
$goto = trim( strtolower( mosGetParam( $_REQUEST, 'link' ) ) );
if ($goto == 'null') {
$msg = $adminLanguage->A_COMP_ALERT_NO_LINK;
mosRedirect( 'index2.php?option=com_admin&task=listcomponents', $msg );
exit();
}
$goto = str_replace( "'", '', $goto );
mosRedirect($goto);
break;
case 'listcomponents':
HTML_admin_misc::ListComponents();
break;
case 'sysinfo':
HTML_admin_misc::system_info( $version, $option );
break;
case 'help':
HTML_admin_misc::help();
break;
case 'preview':
HTML_admin_misc::preview();
break;
case 'preview2':
HTML_admin_misc::preview( 1 );
break;
case 'cpanel':
default:
HTML_admin_misc::controlPanel();
break;
}
?>
contact(تماس با ما)
/**
* @version $Id: admin.contact.php,v 1.1 2005/07/22 01:52:16 eddieajau Exp $
* @package Mambo
* @subpackage Contact
* @copyright (C) 2000 - 2005 M
iro International Pty Ltd
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
* Mambo is Free Software
*/
/** ensure this file is being included by a parent file */
defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
// ensure user has access to this function
if (!($acl->acl_check( 'administration', 'edit', 'users', $my->usertype, 'components', 'all' )
| $acl->acl_check( 'administration', 'edit', 'users', $my->usertype, 'components', 'com_contact' ))) {
mosRedirect( 'index2.php', _NOT_AUTH );
}
require_once( $mainframe->getPath( 'admin_html' ) );
require_once( $mainframe->getPath( 'class' ) );
$id = mosGetParam( $_GET, 'id', 0 );
$cid = mosGetParam( $_POST, 'cid', array(0) );
if (!is_array( $cid )) {
$cid = array(0);
}
switch ($task) {
case 'new':
editContact( '0', $option);
break;
case 'edit':
editContact( $cid[0], $option );
break;
case 'editA':
editContact( $id, $option );
break;
case 'save':
saveContact( $option );
break;
case 'remove':
removeContacts( $cid, $option );
break;
case 'publish':
changeContact( $cid, 1, $option );
break;
case 'unpublish':
changeContact( $cid, 0, $option );
break;
case 'orderup':
orderContacts( $cid[0], -1, $option );
break;
case 'orderdown':
orderContacts( $cid[0], 1, $option );
break;
case 'cancel':
cancelContact();
break;
default:
showContacts( $option );
break;
}
/**
* List the records
* @param string The current GET/POST option
*/
function showContacts( $option ) {
global $database, $mainframe, $mosConfig_list_limit;
$catid = $mainframe->getUserStateFromRequest( "catid{$option}", 'catid', 0 );
$limit = $mainframe->getUserStateFromRequest( "viewlistlimit", 'limit', $mosConfig_list_limit );
$limitstart = $mainframe->getUserStateFromRequest( "view{$option}limitstart", 'limitstart', 0 );
$search = $mainframe->getUserStateFromRequest( "search{$option}", 'search', '' );
$search = $database->getEscaped( trim( strtolower( $search ) ) );
if ( $search ) {
$where[] = "cd.name LIKE '%$search%'";
}
if ( $catid ) {
$where[] = "cd.catid = '$catid'";
}
if ( isset( $where ) ) {
$where = "\n WHERE ". implode( ' AND ', $where );
} else {
$where = '';
}
// get the total number of records
$database->setQuery( "SELECT COUNT(*) FROM #__contact_details AS cd $where" );
$total = $database->loadResult();
require_once( $GLOBALS['mosConfig_absolute_path'] . '/administrator/includes/pageNavigation.php' );
$pageNav = new mosPageNav( $total, $limitstart, $limit );
// get the subset (based on limits) of required records
$query = "SELECT cd.*, cc.title AS category, u.name AS user, v.name as editor"
. "\n FROM #__contact_details AS cd"
. "\n LEFT JOIN #__categories AS cc ON cc.id = cd.catid"
. "\n LEFT JOIN #__users AS u ON u.id = cd.user_id"
. "\n LEFT JOIN #__users AS v ON v.id = cd.checked_out"
. $where
. "\n ORDER BY cd.catid, cd.ordering, cd.name ASC"
. "\n LIMIT $pageNav->limitstart, $pageNav->limit"
;
$database->setQuery( $query );
$rows = $database->loadObjectList();
// build list of categories
$javascript = 'onchange="document.adminForm.submit();"';
$lists['catid'] = mosAdminMenus::ComponentCategory( 'catid', 'com_contact_details', intval( $catid ), $javascript );
HTML_contact::showcontacts( $rows, $pageNav, $search, $option, $lists );
}
/**
* Creates a new or edits and existing user record
* @param int The id of the record, 0 if a new entry
* @param string The current GET/POST option
*/
function editContact( $id, $option ) {
global $database, $my;
global $mosConfig_absolute_path;
$row = new mosContact( $database );
// load the row from the db table
$row->load( $id );
if ($id) {
// do stuff for existing records
$row->checkout($my->id);
} else {
// do stuff for new records
$row->imagepos = 'top';
$row->ordering = 0;
$row->published = 1;
}
$lists = array();
// build the html select list for ordering
$query = "SELECT ordering AS value, name AS text"
. "\n FROM #__contact_details"
. "\n WHERE published >= 0"
. "\n AND catid = '$row->catid'"
. "\n ORDER BY ordering"
;
$lists['ordering'] = mosAdminMenus::SpecificOrdering( $row, $id, $query, 1 );
// build list of users
$lists['user_id'] = mosAdminMenus::UserSelect( 'user_id', $row->user_id, 1 );
// build list of categories
$lists['catid'] = mosAdminMenus::ComponentCategory( 'catid', 'com_contact_details', intval( $row->catid ) );
// build the html select list for images
$lists['image'] = mosAdminMenus::Images( 'image', $row->image );
// build the html select list for the group access
$lists['access'] = mosAdminMenus::Access( $row );
// build the html radio buttons for published
$lists['published'] = mosHTML::yesnoradioList( 'published', '', $row->published );
// build the html radio buttons for default
$lists['default_con'] = mosHTML::yesnoradioList( 'default_con', '', $row->default_con );
// get params definitions
$file = $mosConfig_absolute_path .'/administrator/components/com_contact/contact_items.xml';
$params =& new mosParameters( $row->params, $file, 'component' );
HTML_contact::editcontact( $row, $lists, $option, $params );
}
/**
* Saves the record from an edit form submit
* @param string The current GET/POST option
*/
function saveContact( $option ) {
global $database;
$row = new mosContact( $database );
if (!$row->bind( $_POST )) {
echo " \n";
exit();
}
// save params
$params = mosGetParam( $_POST, 'params', '' );
if (is_array( $params )) {
$txt = array();
foreach ( $params as $k=>$v) {
$txt[] = "$k=$v";
}
$row->params = implode( "\n", $txt );
}
// pre-save checks
if (!$row->check()) {
echo " \n";
exit();
}
// save the changes
if (!$row->store()) {
echo " \n";
exit();
}
$row->checkin();
$row->updateOrder();
if ($row->default_con) {
$database->setQuery( "UPDATE #__contact_details SET default_con='0' WHERE id <> $row->id AND default_con='1'" );
$database->query();
}
mosRedirect( "index2.php?option=$option" );
}
/**
* Removes records
* @param array An array of id keys to remove
* @param string The current GET/POST option
*/
function removeContacts( &$cid, $option ) {
global $database;
if (count( $cid )) {
$cids = implode( ',', $cid );
$database->setQuery( "DELETE FROM #__contact_details WHERE id IN ($cids)" );
if (!$database->query()) {
echo " \n";
}
}
mosRedirect( "index2.php?option=$option" );
}
/**
* Changes the state of one or more content pages
* @param array An array of unique category id numbers
* @param integer 0 if unpublishing, 1 if publishing
* @param string The current option
*/
function changeContact( $cid=null, $state=0, $option ) {
global $database, $my, $adminLanguage;
if (count( $cid ) < 1) {
$action = $state == 1 ? 'publish' : 'unpublish';
echo " \n";
exit;
}
$cids = implode( ',', $cid );
$database->setQuery( "UPDATE #__contact_details SET published='$state'"
. "\nWHERE id IN ($cids) AND (checked_out=0 OR (checked_out='$my->id'))"
);
if (!$database->query()) {
echo " \n";
exit();
}
if (count( $cid ) == 1) {
$row = new mosContact( $database );
$row->checkin( intval( $cid[0] ) );
}
mosRedirect( "index2.php?option=$option" );
}
/** JJC
* Moves the order of a record
* @param integer The increment to reorder by
*/
function orderContacts( $uid, $inc, $option ) {
global $database;
$row = new mosContact( $database );
$row->load( $uid );
$row->move( $inc, "published >= 0" );
mosRedirect( "index2.php?option=$option" );
}
/** PT
* Cancels editing and checks in the record
*/
function cancelContact() {
global $database;
$row = new mosContact( $database );
$row->bind( $_POST );
$row->checkin();
mosRedirect('index2.php?option=com_contact');
}
?>
statistice(آمار گیری)
/**
* @version $Id: admin.statistics.php,v 1.1 2005/07/22 01:53:22 eddieajau Exp $
* @package Mambo
* @subpackage Statistics
* @copyright (C) 2000 - 2005 Miro International Pty Ltd
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
* Mambo is Free Software
*/
/** ensure this file is being included by a parent file */
defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
require_once( $mainframe->getPath( 'admin_html' ) );
switch ($task) {
case 'searches':
showSearches( $option, $task );
break;
case 'pageimp':
showPageImpressions( $option, $task );
break;
default:
showSummary( $option, $task );
break;
}
function showSummary( $option, $task ) {
global $database, $mainframe;
// get sort field and check against allowable field names
$field = strtolower( mosGetParam( $_REQUEST, 'field', '' ) );
if (!in_array( $field, array( 'agent', 'hits' ) )) {
$field = '';
}
// get field ordering or set the default field to order
$order = strtolower( mosGetParam( $_REQUEST, 'order', 'asc' ) );
if ($order != 'asc' && $order != 'desc' && $order != 'none') {
$order = 'asc';
} else if ($order == 'none') {
$field = 'agent';
$order = 'asc';
}