Jump to content
xisto Community

annyphp

Members
  • Content Count

    13
  • Joined

  • Last visited

Posts posted by annyphp


  1. PHPKode help desk software X is a must-have for any new or existing on line business. Even if the majority of your business is off-line, many people prefer on line product and service support. Customers need their questions answered quickly and personnel need a way to effectively manage their work. Help desk software is an economic , easy-to-use and useful tool for the growth of your business.

    It helps customers who can simply submit an inquiry to the appropriate department and expect a timely response. With the use of this product the customer and technical support staff are better able to manage troubleshooting.

    Here below I m going to mention some significant features of PHPKode Help Desk Software X:
    * Multi-department collabration functionality aims to provide effective communication within and between departments, and then increasing customer satisfaction.
    * Custom Helpdesk Ticket Form for detailed customer information.
    * Modified Ticket Status.
    * Added the users rate.
    More customer service solution you can check out here: help desk software


  2. Zend framework is extremely flexible and it supports all the features of the latest version of PHP framework.

    Zend framework even facilitates the creation of Search Engine friendly URLs.

    PHP developers can utilize the frameworks various components without developing it within the framework structure.

     

    Latest version of Zend frameworks with its features The latest version of Zend framework that is used for PHP web application is Zend Framework 1.10.2. This particular version does include a range of features that makes it much more effective and constructive from its earlier versions.

     

    Model-View-Controller (MVC): This is one of the major components that separate code implementation and design easily thereby helping PHP developers to create effective applications conveniently.

     

    Tooling and Rapid Application Development (RAD): The initial application setup can be quite difficult and tedious and RAD offers tooling support and a command line client. This helps PHP web application by easily generating project architecture, MVC artifacts and other features.

     

    Database: Zend framework uses the best practices of standard database programs and it allows PHP developers to build application models based on the database engines they require.

     

    Internationalization and Localization Since PHP web application is outsourced to countries like India frequently therefore it has become imperative to add certain languages to the web applications. This tool allows PHP developers to easily add a particular language in order to cater to the expanding markets.

    More free and open source PHP framework projects listed on PHPKode.com. Such as : Zend Framework, CakePHP, Symfony Framework, CodeIgniter, Akelos, Yii framework etc.


  3. Hi,

    May be you can find some free php script on PHPKod.com

    <?php// ----------------------------------------------------------------------//  Main HTML function// ----------------------------------------------------------------------function html($element, $content = null, $args = null) {	// Opening    $output = "\n" . '<' . $element;	// Arguments    if ($args != null && is_array($args)) {                // Wofür?        $args_num = count($args);        foreach ($args as $key => $value) {           	$output .= ' ' .$key. '="' .$value. '"';	       	}    }        // Standalone arguments    else if ($args != null && ! is_array($args)) {		$output .= ' ' .$args;					}  	// Closing tag for standalone tags    if ( ! $content) {        $output .= ' />' . "\n";        }        // Closing tag    else {    	$output .= '>' . trim($content) . '</' . $element . '>';        // $output .= '>' . "\n" . trim($content) . "\n" . '</' . $element . '>';    }    return $output . "\n";}// ----------------------------------------------------------------------//  HTML child functions// ----------------------------------------------------------------------function html_head($content, $args = null) { return html('head', $content, $args); }function html_body($content, $args = null) { return html('body', $content, $args); }function html_title($title) { return html('title', $title); }function html_h1($content, $args = null) { return html('h1', $content, $args); }function html_h2($content, $args = null) { return html('h2', $content, $args); }function html_h3($content, $args = null) { return html('h3', $content, $args); }function html_h4($content, $args = null) { return html('h4', $content, $args); }function html_h5($content, $args = null) { return html('h5', $content, $args); }function html_h6($content, $args = null) { return html('h6', $content, $args); }function html_p($content, $args = null) { return html('p', $content, $args); }function html_div($content, $args = null) { return html('div', $content, $args); }function html_header($content, $args = null) { return html('header', $content, $args); }function html_footer($content, $args = null) { return html('footer', $content, $args); }function html_section($content, $args = null) { return html('section', $content, $args); }function html_article($content, $args = null) { return html('article', $content, $args); }function html_aside($content, $args = null) { return html('aside', $content, $args); }function html_figure($content, $args = null) { return html('figure', $content, $args); }function html_legend($content, $args = null) { return html('legend', $content, $args); }function html_dialog($content, $args = null) { return html('dialog', $content, $args); }function html_span($content, $args = null) { return html('span', $content, $args); }function html_blockquote($content, $cite, $args = null) { if(isset($cite)) { $args['cite'] = $cite; } return html('blockquote', $content, $args); }function html_quote($content, $cite, $args = null) { if(isset($cite)) { $args['cite'] = $cite; } return html('blockquote', $content, $args); } function html_q($content, $cite, $args = null) { if(isset($cite)) { $args['cite'] = $cite; } return html('q', $content, $args); } // Alias for blockquotefunction html_code($content, $args = null) { return html('code', $content, $args); }function html_pre($content, $args = null) { return html('pre', $content, $args); }function html_dl($content, $args = null) { return html('dl', $content, $args); }function html_dt($content, $args = null) { return html('dt', $content, $args); }function html_dd($content, $args = null) { return html('dd', $content, $args); }function html_br($args = null) { return html('br', '', $args); }function html_hr($args = null) { return html('hr', '', $args); }function html_strong($content, $args = null) { return html('strong', $content, $args); }function html_em($content, $args = null) { return html('em', $content, $args); }function html_address($content, $args = null) { return html('address', $content, $args); }function html_abbr($content, $args = null) { return html('abbr', $content, $args); }function html_acronym($content, $args = null) { return html('acronym', $content, $args); }function html_samp($content, $args = null) { return html('samp', $content, $args); }function html_kbd($content, $args = null) { return html('kbd', $content, $args); }function html_dfn($content, $args = null) { return html('dfn', $content, $args); }function html_del($content, $args = null) { return html('del', $content, $args); }function html_ins($content, $args = null) { return html('ins', $content, $args); }function html_button($content, $args = null) { return html('button', $content, $args); }function html_link($content, $args = null) { return html('link', $content, $args); }function html_var($content, $args = null) { return html('var', $content, $args); }function html_mark($content, $args = null) { return html('mark', $content, $args); }function html_time($content, $args = null) { return html('time', $content, $args); }function html_meter($content, $args = null) { return html('meter', $content, $args); }function html_progress($content, $args = null) { return html('progress', $content, $args); }/* Vertragen noch speziellere Behandlung (vielleicht ausgelagert in Media.php) */function html_audio($args = null) { return html('audio', '', $args); }function html_video($args = null) { return html('video', '', $args); }// ----------------------------------------------------------------------//  Form// ----------------------------------------------------------------------function html_form($fields, $args = null) { 	// Handle args	if( ! isset($args['method'])) { $args['method'] = 'post'; } 	if( ! isset($args['action'])) { $args['action'] = $_SERVER['PHP_SELF']; } 		// Output	return html('form', $fields, $args); }// ----------------------------------------------------------------------//  Input fields// ----------------------------------------------------------------------function html_input($type = text, $name = null, $value = null, $args = null) {	// Handle args	if(isset($type)) { $args['type'] = $type; }	if(isset($name)) { $args['name'] = format_value($name); } 	if(isset($value)) { $args['value'] = $value; } 		if( ! isset($args['id'])) { $args['id'] = format_value($name); } 				// Output	return html('input', '', $args); }function html_input_text($name = null, $value = null, $args = null) {	// Handle args	$args['type'] = 'text'; 	if(isset($name)) { $args['name'] = $name; } 	if(isset($value)) { $args['value'] = $value; } 		// Output	return html('input', '', $args); }function html_input_password($name = null, $value = null, $args = null) {	// Handle args	$args['type'] = 'password'; 	if(isset($name)) { $args['name'] = $name; } 	if(isset($value)) { $args['value'] = $value; } 		// Output	return html('input', '', $args); }// ----------------------------------------------------------------------//  Aliases for html_input($type, $name, $value)// ----------------------------------------------------------------------function html_input_checkbox($name, $value = null, $args = null) { return html_input('checkbox', $name, $value, $args); }function html_input_radio($name, $value = null, $args = null) { return html_input('radio', $name, $value, $args); }function html_input_submit($text = 'Submit', $args = null) { return html_input('submit', 'submit_button', $text, $args); }function html_input_reset($text = 'Reset', $args = null) { return html_input('reset', 'reset_button', $text, $args);  }function html_input_hidden($name, $value, $args = null) { return html_input('hidden', $name, $value, $args); }// ----------------------------------------------------------------------//  UNCOMPLETE: Aliases for new HTML5 Form Elements// ----------------------------------------------------------------------function html_input_date($name, $value, $args) { return html_input('date', $name, $value, $args); };// ----------------------------------------------------------------------//  Textarea// ----------------------------------------------------------------------function html_textarea($name = null, $value = ' ', $args = null) {	// Handle args	if(isset($name)) { 		$args['name'] = format_value($name); 	} 	// Output a space if no value is given	if($value == '') { 		$value = ' '; 	} 	// ID	if( ! isset($args['id'])) { 		$args['id'] = format_value($name); 	} 			// Output	return html('textarea', $value, $args);}// ----------------------------------------------------------------------//  Select// ----------------------------------------------------------------------function html_select($name, $options_array, $args = null) {	$options = '';	$opt_count = 0;		foreach($options_array as $title => $value) {			// fals $options_array eindimensional (ohne values)		if(is_integer($title))		{			$title = $value;			$value = $opt_count;		}				$opt_args['value'] = $value;		$options .= html('option', $title, $opt_args);		$opt_count++;	}		if( ! isset($args['name'])) {			$args['name'] = $name;	}		return html('select', $options, $args);}// ----------------------------------------------------------------------//  Label// ----------------------------------------------------------------------function html_label($label, $for = null, $args = null) {	if(isset($for)) { $args['for'] = $for; } 	return html('label', $label, $args);}// ----------------------------------------------------------------------//  Fieldset// ----------------------------------------------------------------------function html_fieldset($content, $args = null) { 	return html('fieldset', $content, $args); }// ----------------------------------------------------------------------//  Formfield Wrapper// ----------------------------------------------------------------------function html_formfield_wrapper($name, $content, $args = null) {	if($name != '') {		$content = html_label($name, format_value($name)) . $content;		$args['id'] = 'field-' . format_value($name);	}	$args['class'] = 'form-field';		return html_div($content, $args);}/*html_formfield()UNDER DEVELOPMENTDas soll eine Form Field-Funktion für alle Felder werden.Nötig?*/function html_formfield($options) {	$field = html_label($options['name']);	// $field .= '<label for="'.$options['name'].'">'.$options['name'].'</label>';		switch($options['type']) {			case 'text': 		$field .= html_input_text($options['name'], $options['value'], $options['args']); break;		case 'textarea': 	$field .= html_textarea($options['name'], $options['value'], $options['args']); break;		// Checkbox & Radio müssen anders gelöst werden	}			return html_div($field, array('class' => 'form-field'));}/* Returns the opening tag of a form. *//* kann nicht per html() gemacht werden, wegen des / bei Inline-Elementen */function html_form_open($name = null, $args = null) {	if(isset($name)) {			$args['name'] = $name; 		$args['id'] = $name; 			}		if( ! isset($args['method'])) { $args['method'] = 'post'; }		if( ! isset($args['action'])) { $args['action'] = $_SERVER['PHP_SELF']; } 			$output = '<form ';  	 	foreach($args as $key => $value) { 	    	$output .= ' ' .$key. '="' .$value. '"';	   	}		$output .= '>';   	return $output;}function html_form_close() { 	return '</form>'; }class HTMLForm{	function field($field) {				$this->fields .= $field;	}	function output() {			return html_form(			$this->fields .			html_input_submit()		);	}}// Funktioniert noch nicht:function html_jumpmenu($options_array, $select_args = null) {	$args['name'] = 'Jumpmenu';		$select_args['name'] = 'Menu';	$select_args['value'] = 'GO';	$select_args['onChange'] = 'location=document.Jumpmenu.Menu.options[document.Jumpmenu.Menu.selectedIndex].value;';		return html_form(html_select($name, $options_array, $select_args), $args);}// ----------------------------------------------------------------------//  Images////  Example://      print html_img('apple.jpg');//  outputs://      <img src="apple.jpg" width="166" height="191" alt="apple.jpg" title="apple.jpg" /> //function html_img($src, $args = null) {	// Title	if( ! $args['title']) { $title = basename($src); }	else { $title = $args['title']; }	// Alt	if( ! $args['alt']) { $alt = $title; }	else { $alt = $args['alt']; }	// Get image info    $info = getimagesize($src);	// Width	if( ! $args['width']) { $width = $info['0']; }	else { $width = $args['width']; }		// Height	if( ! $args['height']) { $height = $info['1']; }	else { $height = $args['height']; }    return html('img', '', array('src' => $src, 'width' => $width, 'height' => $height, 'alt' => $alt, 'title' => $title));}// Alias for html_img()function image($src, $args = null) { return img($src, $args); }// ----------------------------------------------------------------------//  Links//function html_a($href, $text = null, $args = null) {    // href    if($href == "index" or $href == "home") {            // './' ersetzen durch $basepath oder sowat        $args['href'] = './';    }    else {            // $href beginnt nicht mit "http://" (case insensitiv)        if( ! preg_match("/^http:\/\//i", $href)) {                    // $href beginnt mit "www" (case insensitiv)            if(preg_match("/^www/i", $href)) {                $args['href'] = ereg_replace("www", "http://www", $href);            }            // $href beginnt mit Punkt (relativer Link)            else if(preg_match("/^./i", $href)) {                $args['href'] = $href;            }                        // $href beginnt nicht mit "www" (case insensitiv)            else {                          $args['href'] = "http://forums.xisto.com/no_longer_exists/;            }        }         else {  			$args['href'] = $href;		}    }        // target    if( ! isset($args['target']) or $args['target'] == "self") {        $args['target'] = "_self";    }    elseif($args['target'] == "blank" or $args['target'] == "new") {        $args['target'] = "_blank";    }    // text    if($text == null) {        $text = "$href";    }        // title    if( ! isset($args['title'])) {        $args['title'] = $text;    }    else {        $args['title'] = $args['title'];    }	// ---------------------------------------------------------------------	// DEV:	// MAILTO-Links	    // $href beginnt mit "mailto:" (case insensitiv)    if(preg_match("/^mailto:/i", $args['href'])) {		$args['title'] = ereg_replace("mailto:", "", $args['title']);    }    if(preg_match("/^mailto:/i", $text)) {		$text = ereg_replace("mailto:", "", $text);    } 	// ---------------------------------------------------------------------    // output    return html('a', $text, $args);}// ----------------------------------------------------------------------//  Mailto() //  Sollte idealerweise in a() implementiert sein (angefangen - args fehlen noch)// ----------------------------------------------------------------------function mailto($address, $text = null, $args = null) {		$mail_args = array();		// in subject und body sollten noch leerzeichen und sonderzeichen umgewandelt werden	if(isset($args['subject'])) { $mail_args['subject'] = $args['subject']; unset($args['subject']); }	if(isset($args['body'])) 	{ $mail_args['body'] 	= $args['body']; 	unset($args['body']); }	if(isset($args['cc'])) 		{ $mail_args['cc'] 		= $args['cc']; 		unset($args['cc']); }			if(isset($args['bcc'])) 	{ $mail_args['bcc'] 	= $args['bcc']; 	unset($args['bcc']); }					// build href	$args['href'] = 'mailto:'.$address;		if(count($mail_args > 0)) {			$args['href'] .= '?'; // Wieso wird das auch ohne $mail_args ausgeworfen? 				foreach($mail_args as $key => $value) {		           	$args['href'] .= $key.'='.$value.'&';	   		}	}		if( ! isset($text)) {			$text = $address;	}	return html('a', $text, $args);}// ----------------------------------------------------------------------//  Listen// ----------------------------------------------------------------------function html_list($list_type, $items, $args = null) {	$list_items = null;		foreach($items as $key => $value) 	{		$list_items .= html('li', $value);	}	$list = html($list_type, $list_items, $args); 	return $list;}function html_ul($items, $args = null) { return html_list('ul', $items, $args); }function html_ol($items, $args = null) { return html_list('ol', $items, $args); }function html_li($content, $args = null) { return html('li', $content, $args); }// ----------------------------------------------------------------------// Advanced list// ----------------------------------------------------------------------// Diese Weiterentwicklung nutzt die Möglichkeit einer Funktion eine// unbegrenzte Anzahl von Argumenten zu übergeben.// So muss für die Listen-Items kein Array mehr verwendet werden.// Ist ein Argument ein Array, wird es automatisch als Argumentenkette// des vorherigen List-Items genutzt (bis auf das erste Argument - das// wird als Argumentenkette für die umschlieÃende Liste genutzt).//// @Example:// new_html_list(//     array('id' => 'my-list'),//     eins,//     zwei, array('id' => 'second-item', 'class' => 'list-items'),//     drei// );//// @ToDo:// Implementierung des Listen-Typs zur "Vererbung" an ul() und ol().// Ansonsten scheint es recht fertig.function html_adv_list() {    $args = func_get_args();    $list_type = array_shift($args[0]);    // Wenn das erste Argument ein Array ist, wird es als Argumenten-    // Kette für die Liste benutzt.    if(is_array($args[0])) {            $argument_1 = array_shift($args);                foreach($argument_1 as $key => $value) {                    $list_args[$key] .= $value;        }    }    $li_num = 0;    foreach($args as $key => $value) {            $li_num ++;        		// Argument ist ein Listenpunkt (kein Array)        if( ! is_array($args[($li_num-1)])) {                    $li_content = $value;        }        		// Argument ist ein Argumenten-Array        else {                        foreach($value as $key2 => $value2) {                            $li_args[$key2] .= $value2;            }        }        		// Der Array-Key ist jeweils eins unter dem $li_num        // (der bei eins, anstatt 0 beginnt)        $next_li = $li_num;        		if( ! is_array($args[$next_li])) {		            $list_items .= html('li', $li_content, $li_args);            $li_args = '';        }    }    return html($list_type, $list_items, $list_args);}function html_adv_ul($items) { return html_adv_list('ul', $items); }function html_adv_ol($items) { return html_adv_list('ol', $items); }// ----------------------------------------------------------------------//  Tables// ----------------------------------------------------------------------// To Do://// - thead, tbody, tfoot so anlegen, das der Head autom. oben, der Foot //   automatisch unten ausgegeben wird.// - html() nutzen// - Funktion von dieser Klasse ableiten://   table(//       array('head_item_1', 'head_item_2', 'head_item_3'), //       array('tr_item_1', 'tr_item_2', 'tr_item_3'), //       array('foot_item_1', 'foot_item_2', 'foot_item_3') //   );class HTMLTable {    function __construct($cols = '') 	{            $this->table = '';                if($cols) {            $this->head($cols);        }    }    function row($tag, $cols, $container_tag = '') 	{        if($container_tag != '') {            $this->table .= '<' . $container_tag . '>';        }        $this->table .= '<' . $tag . '>';        foreach($cols as $col) {            $this->table .= '<td>' . $col . '</td>';            $this->table .= "\n";        }                $this->table .= '</' . $tag . '>';        $this->table .= "\n";                if($container_tag != '') {            $this->table .= '</' . $container_tag . '>';            $this->table .= "\n";        }        }    function head($cols) 	{        $this->row('tr', $cols, 'thead');    }    function foot($cols) 	{        $this->row('tr', $cols, 'tfoot');    }    /* Noch ohne Sinn, weil trs und rows dem tbody nicht zugeordnet werden können */    function body($cols) 	{        $this->row('tr', $cols, 'tbody');    }    function tr($cols) 	{        $this->row('tr', $cols);    }    function display($args = '') 	{        return html('table', $this->table, $args);    }}/* ------------------------------------------------------------------object(	'file.swf', 	array('width' => '220'), 	array('paramname' => 'paramwert'))generiert:<object width="220"><param name="paramname" value="paramwert" />Your browser cant show this object.</object>*/function html_object($filename, $args = null, $params = null, $alt_text = 'Your browser cant show this object.'){	$args['data'] = $filename;		if(is_array($params))	{		$params_string = '';				foreach($params as $key => $value) 		{			$param_args['name'] = $key;				$param_args['value'] = $value;		        	$params_string .= html('param', '', $param_args)."\n";    	}	}		$content = (isset($params_string)) ? $params_string : ''; 	$content .= $alt_text;			return html('object', $content, $args); }/* --------------------------------------------------------------------------Head helper-------------------------------------------------------------------------- */function html_doctype($type = 'html5') { 	switch($type) {		case 'transitional': return '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://forums.xisto.com/no_longer_exists/;; break;		case 'strict': 		 return '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://forums.xisto.com/no_longer_exists/;; break;		case 'html5': 		 return '<!DOCTYPE html>'; break;	}}function html_link_css($files, $media = null) {	if( ! is_array($files)) { 		if($media == null) {			$media = 'screen';			}		$css_file = $files;		$output = html('link', '', array('href' => $css_file, 'media' => $media, 'rel' => 'stylesheet', 'type' => 'text/css'));	}	else {		foreach($files as $key => $value) {			if(is_int($key)) {				$media = 'screen';				$css_file = $value;			} else {				$media = $value;				$css_file = $key;			}					$output = html('link', '', array('href' => $css_file, 'media' => $media, 'rel' => 'stylesheet', 'type' => 'text/css'));										}	}	return $output;}	function html_link_js($file) { return html('script', ' ', array('src' => $file, 'type' => 'text/javascript')); }function html_style($css) { return html('style', '<!--'."\n".$css."\n".'-->', array('type' => 'text/css')); }function html_css($css) { return html_style($css); }function html_js($js) { return html('script', '<!--'."\n".$js."\n".'-->', array('type' => 'text/javascript')); }function html_javascript($script) { return html_js($script); } // Alias for js()// ----------------------------------------------------------------------//  Helper// ----------------------------------------------------------------------function html_clear($element = 'br', $content = null, $args = null) { 	$args['style'] = 'clear: both;';	return html($element, $content, $args); }function html_comment($comment) {	return "\n" . '<!-- ' . $comment . ' -->' . "\n";}function html_js_alert($string) {	return js('alert("'.$string.'")');}function html_page($title, $body, $options = null) {		$page = 		$page = doctype().		html('html', 			head(title($title).css($options['css'])).			body($body)	);		return $page;}// ----------------------------------------------------------------------//  Layout// ----------------------------------------------------------------------class HTMLCols{	function __construct() 	{		$this->col_num = 0;	}		function col($content) 	{		$this->col_num ++;		$this->collumns[] = $content;	}	function display() 	{			/*		switch($this->col_num) 		{			case 1: $this->col_width = '100%'; break;			case 2: $this->col_width = '49.5%'; break;			case 3: $this->col_width = '32.5%'; break;			case 4: $this->col_width = '24.5%'; break;			case 5: $this->col_width = '19.5%'; break;			case 6: $this->col_width = '16.5%'; break;				}		*/				$this->col_width = 100 / $this->col_num . '%';						$num = 0;		$output = '';				foreach($this->collumns as $key => $value) 		{			$num ++;			$output .= html_div($value, array('style' => 'float: left; width: '.$this->col_width, 'id' => 'col-'.$num));		}		$output .= html_clear();				return $output;	}}function html_cols() {	$contents = func_get_args();	$layout = new HTMLCols;		foreach($contents as $value) {		$layout->col($value);	}	return $layout->display();}class HTMLPage {    function __construct($title = '') {        $this->head = '';        $this->title = $title;        $this->charset = 'UTF-8';        $this->body = '';        $this->bodyArgs = array();    }    function addHead($head_content) {        $this->head .= $headContent;    }		function addJS($js) {        $this->js .= $js;    }    function addStylesheet($stylesheet_file, $media = 'screen') {		// $this->stylesheets .= linkCSS($stylesheet_file, $media);        $this->stylesheets .= '<link rel="stylesheet" type="text/css" href="'.$stylesheet_file.'" media="'.$media.'" />';		$this->stylesheets .= "\n";    }        function addStyle($styleContent) {        $this->style .= $styleContent;        $this->style .= "\n";    }        function addCSS($selector, $values) {        $this->css .= $selector .' { ';        if($values != '' && is_array($values)) {            foreach($values as $key => $value) {                $this->css .= $key. ': ' .$value. '; ';            }        }        $this->css .= '}';        $this->css .= "\n";    }	function addJSFile($file) {		$this->js_files .= '<script src="'.$file.'" type="text/javascript"></script>' . "\n";		}    function addTitle($title) {        $this->title .= $title;    }        function addCharset($charset) {        $this->charset = $charset;    }    function addBody($bodyContent, $bodyArgs = '') {        $this->body .= $bodyContent;        $this->bodyArgs .= $bodyArgs;    }        function addBodyArgs($bodyArgs) {        $this->bodyArgs .= $bodyArgs;    }        function output() {        print '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://forums.xisto.com/no_longer_exists/;;        print "\n\n";        print "<html>\n\n";        print "<head>\n";                if($this->title != '') {            print '<title>' . $this->title . '</title>';        }                print "\n";        print '<meta http-equiv="Content-Type" content="text/html; charset='.$this->charset.'"/>';        print "\n";        if($this->stylesheets != '') {            print "\n";            print $this->stylesheets;            print "\n";        }        if($this->js_files != '') {            print "\n";            print $this->js_files;            print "\n";        }                if($this->style != '' or $this->css != '') {            print '<style type="text/css">';            print "\n";            print '<!--';            print "\n";            print $this->css;            print $this->style;            print '-->';            print "\n";            print '</style>';            print "\n";        }                if($this->js != '') {            print '<script type="text/javascript">';            print "\n";            print '<!--';            print "\n";            print $this->js;            print '-->';            print "\n";            print '</script>';            print "\n";        }        		        print $this->head;        print "</head>\n\n";        print "<body";        if($this->bodyArgs != '' && is_array($this->bodyArgs)) {            foreach($this->bodyArgs as $key => $value) {                print ' ' .$key. '="' .$value. '"';            }        }        print ">\n\n";        print $this->body;        print "\n\n</body>\n\n";        print "</html>\n";    }}/*$page = new HTMLPage('My Page');$page->addCSS('a', array('font-family'=>'arial'));$page->addStyle('* { font-family: arial; color: #333 }');$page->addStyle('a { font-weight: bold; color: #09f }');$page->addBody(    link('fatboy.jpg').    image('fatboy.jpg').    $table->display(array('class'=>'pretty_table'))    );$page->addBodyArgs(array('id'=>'my_page'));$page->render();*/// ----------------------------------------------------------------------//  Format Helper// ----------------------------------------------------------------------function format_value($string) {	$string = str_replace(' ', '_', $string);  	$string = strtolower($string);	return $string;}?>

  4. How to make a News script with PHP + MySQL

     

     

     

    So..in this tutorial i will explain how to create PHP news script.

     

    first we have to create the table in My SQL..

     

    with the code below you will do this ( you have to enter it into SQL field ..in PHPmyADMIN)

     

    CREATE TABLE news ( id int(10) unsigned NOT NULL auto_increment, postdate timestamp(14) NOT NULL, title varchar(50) NOT NULL default '', content text NOT NULL, PRIMARY KEY (id), KEY postdate (postdate), FULLTEXT KEY content (content) ) 

     

     

     

    >>>> script files

     

    1 file will show the news ,1 file will contain variables and with the third one we can add news.

     

    we'll call the first file "news.php"

     

    <?php$query = "SELECT *," ."DATE_FORMAT(postdate, '%Y-%m-%d') as date " ."FROM news ORDER BY id DESC LIMIT $news_limit"; // 1.$result = mysql_query($query);while($r=mysql_fetch_array($result)) // 2.{echo "<br><table width='100%'><tr bgcolor='$title_cell_color'><td><img src='$bullet'><b>$title</b> posted on $date</td></tr><tr bgcolor='$news_cell_color'><td>$content</td></tr></table><br>";}?>

    explaination:

     

    1. inlcuding variables into the script

     

    2. selecting the table in the db,formating date, limiting the number of news the script is going to show.

     

    3. now the script is writing the data form db into tables.

     

     

     

    now we have to make another file which can add new news into db.

     

    we will call it "add.php"

     

    <?phpinclude "var.php"; // 1.if ($action==add) // 2.{$title=$_POST['title'];$content=$_POST['content']; // 3.mysql_query("insert into news (title,content) VALUES ('$title','$content')");echo "<a href='index.php'>Home</a>"; // 4.}else // 4.{print "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td><form name=\"form1\" method=\"post\" action=\"add.php?action=add\"><div align=\"center\"><p>Title:<input type=\"text\" name=\"textfield\"></p><p>News content :<textarea name=\"title\" cols=\"50\" rows=\"10\" id=\"title\"></textarea></p><p><input type=\"submit\" name=\"Submit\" value=\"Add\"></p></div></form></td></tr></table>\n";}?>

    explaination:

     

    1. includeing variables into the script

     

    2. if the $action id add..then the script is going to add data into the db,and if $action isn't selected,then the scipt is gonna show form for adding news.

     

    3. the script is putting the data that we have entered into variables

     

    4. if $action isn't set to "add" the script is showing a form for adding news

     

     

     

    this is the third file....we are gonna define all important variables here..and we're gonna make a connection to db.

     

    <?php////////////////////////////////////////////////////////////////////////////////////////$news_limit="xxxx"; // number of news that script shows$user="xxxx"; // db username$pass="xxxx"; // password$db_name="xxxx"; // database name$bullet="xxxx"; // path to the bullet image$title_cell_color="xxxx"; // bg color for title cell in RGB...(black = #000000)$news_cell_color="xxx"; // bg color for news cell in RGB...(black = #000000)////////////////////////////////////////////////////////////////////////////////////////$db = mysql_connect("localhost", "$user", "$pass");mysql_select_db("$db_name", $db); //?>

    You have to change all the variables.

     

     

     

    You can download all script files here.

     

    http://forums.xisto.com/no_longer_exists/

     

     

     

    ..if you have some questions are if you have found a mistake in this script...please let me know. (post here)

     

    More Free PHP News script you can check out at PHPKode.com
×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.