Re: [PHP] Problem Directing the Page with header
2007. 02. 15, csütörtök keltezéssel 18.41-kor Ashish Rizal ezt írta: Hey Jim, Thanks for the quick response. I have actually made the whole code on same page (login.php) and the functions that i used in this code are in functions.php. Now this time it is showing the warning : Warning: Cannot modify header information - headers already sent by (output started at C:\Program Files\xampp\htdocs\fselection\login.php:1) in C:\Program Files\xampp\htdocs\fselection\login.php on line 19 The line 19 is header(Location: http://$host$uri/$extra;); it says you sent out some output on line 1 what is on line 1? maybe you have a blank line in the beginning of your php file? greets Zoltán Németh Below is the list of code for login.php. The Server i am using is SunOS 5.10. ?php session_start(); require_once 'functions.php'; $UserName = $_POST['UserName']; $Password = $_POST['Password']; $host = $_SERVER['HTTP_HOST']; $uri = rtrim(dirname($_SERVER['PHP_SELF']), '/\\'); $extra = 'adminlogin.php'; $loc = \http://$host$uri/$extra\;; if ($_POST){ $error = login_check($_POST); if (trim ($error)==) { $accesslevel = accessLevel($UserName); ? ?php if ($accesslevel == admin){ $_SESSION[userid] = login($_POST); header(Location: http://$host$uri/$extra;); exit(); } else if ($accesslevel == user) { //echo this is user; $_SESSION[userid] = login($_POST); header('Location: userlogin.php'); exit(); } } else { print Error :$error; } } ? BODY FORM id=form1 name=loginform method=post TABLE align=center ***Login Form Goes Here ** nothing php Stuffs on this part /body Thank you again for your time and consideration. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Detecting user_abort when using ob_start().
Hello there, I have a script which is called using ajax. This script can take a while executing. Now it sometimes happens that a user aborts a connection, like stop the ajax request. This won't stop the php script from executing. Now i need some way to detect if the user has stoped/aborted the connection. I tryed to use connection_aborted and/or connection_status. But this doesn't seem to work or something. I Tryed to search for a sollution, but not much luck. Also, i use ob_start() because of headers that needs to be sent and to compress etc.. Thx in advance. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: array_pop() with key-value pair ???
I guess you have tried foreach? foreach ($array as $key = $value) { ... } Mikey Eli wrote: More over.. PHP seems to be quiet slow when dealing with array_shift() array_unshift(), but it is much faster with array_pop() array_push(). I am not familiar with the PHP internals, but why not add a pointer to the start and end of the array? Good word can be said on PHP that accelerated at least count() function.. Maybe I require too much.. PHP is a rapid development scripting language.. not a massive optimized programming language.. :-/ Eli wrote: Hi, Why isn't there a function that acts like array_pop() returns a pair of key-value rather than the value only ? Reason is, that in order to pop the key-value pair, you do: ?php $arr = array('a'=1,'b'=2,'c'=3,'d'=4); $arr_keys = array_keys($arr); $key = array_pop($arr_keys); $value = $arr[$key]; ? I benchmarked array_keys() function and it is very slow on big arrays since PHP has to build the array. While array_pop() can be acceleraed by the guts of PHP engine. -thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with Redirect
Hi! Ashish Rizal escribió: Hi friends, I am having problem with following code. I have actually made the whole code on same page (login.php) and the functions that i used in this code are in functions.php. Now this time it is showing the warning : Warning: Cannot modify header information - headers already sent by (output started at C:\Program ... $accesslevel = accessLevel($UserName); ? ?php if ($accesslevel == admin){ ... ANy help would be highly appreicated. Thanks There is a \n between the ? and the ?php that is causing the warning. You cannot send any output before all the headers. You don't need that ? followed by ?php because this makes no sense so delete it. Greetings from Spain! -- David Blanco - Programación y sistemas Publicinet (Publicidad-Cine-Internet, S.L.) Urzaiz, 71, entlo, izda. -- 36204 Vigo Telf 902.014.606 -- http://www.publicinet.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] array_pop() with key-value pair ???
On 16/02/07, Eli [EMAIL PROTECTED] wrote: Hi, Why isn't there a function that acts like array_pop() returns a pair of key-value rather than the value only ? Reason is, that in order to pop the key-value pair, you do: ?php $arr = array('a'=1,'b'=2,'c'=3,'d'=4); $arr_keys = array_keys($arr); $key = array_pop($arr_keys); $value = $arr[$key]; ? I benchmarked array_keys() function and it is very slow on big arrays since PHP has to build the array. benchmark this: end($arr); list($key, $value) = each($arr); -robin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] array_pop() with key-value pair ???
2007. 02. 16, péntek keltezéssel 10.23-kor Robin Vickery ezt írta: On 16/02/07, Eli [EMAIL PROTECTED] wrote: Hi, Why isn't there a function that acts like array_pop() returns a pair of key-value rather than the value only ? Reason is, that in order to pop the key-value pair, you do: ?php $arr = array('a'=1,'b'=2,'c'=3,'d'=4); $arr_keys = array_keys($arr); $key = array_pop($arr_keys); $value = $arr[$key]; ? I benchmarked array_keys() function and it is very slow on big arrays since PHP has to build the array. benchmark this: end($arr); list($key, $value) = each($arr); array_pop also removes the element from the array so add one more line: unset($arr[$key]); greets Zoltán Németh -robin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] array_pop() with key-value pair ???
On 16/02/07, Németh Zoltán [EMAIL PROTECTED] wrote: 2007. 02. 16, péntek keltezéssel 10.23-kor Robin Vickery ezt írta: On 16/02/07, Eli [EMAIL PROTECTED] wrote: Hi, Why isn't there a function that acts like array_pop() returns a pair of key-value rather than the value only ? Reason is, that in order to pop the key-value pair, you do: ?php $arr = array('a'=1,'b'=2,'c'=3,'d'=4); $arr_keys = array_keys($arr); $key = array_pop($arr_keys); $value = $arr[$key]; ? I benchmarked array_keys() function and it is very slow on big arrays since PHP has to build the array. benchmark this: end($arr); list($key, $value) = each($arr); array_pop also removes the element from the array so add one more line: unset($arr[$key]); Yeah, but he's not actually popping the last element of $arr, he's just using it to get the last key from $arr_keys. -robin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] array_pop() with key-value pair ???
2007. 02. 16, péntek keltezéssel 10.47-kor Robin Vickery ezt írta: On 16/02/07, Németh Zoltán [EMAIL PROTECTED] wrote: 2007. 02. 16, péntek keltezéssel 10.23-kor Robin Vickery ezt írta: On 16/02/07, Eli [EMAIL PROTECTED] wrote: Hi, Why isn't there a function that acts like array_pop() returns a pair of key-value rather than the value only ? Reason is, that in order to pop the key-value pair, you do: ?php $arr = array('a'=1,'b'=2,'c'=3,'d'=4); $arr_keys = array_keys($arr); $key = array_pop($arr_keys); $value = $arr[$key]; ? I benchmarked array_keys() function and it is very slow on big arrays since PHP has to build the array. benchmark this: end($arr); list($key, $value) = each($arr); array_pop also removes the element from the array so add one more line: unset($arr[$key]); Yeah, but he's not actually popping the last element of $arr, he's just using it to get the last key from $arr_keys. well, sorry, I didn't examine his code just read his original question saying a function that acts like array_pop() it's now up to him to decide whether he wants to unset that element or not :) greets Zoltán Németh -robin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Text Editor for Windows?
PDT - PHP Eclipse -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem Directing the Page with header
On Thu, 15 Feb 2007, Ashish Rizal wrote: ?php session_start(); require_once 'functions.php'; $UserName = $_POST['UserName']; $Password = $_POST['Password']; $error = login_check($_POST); $adminAddress = getAbsolutePath().'adminlogin.php'; $userAddress = getAbsolutePath().'userlogin.php'; $samePage = getAbsolutePath().'login-new.php'; if (trim ($error)==) { $accesslevel = accessLevel($UserName); if ($accesslevel == admin){ $_SESSION[userid] = login($_POST); You need to put a session_commit(); here, so session gets writen. header(Location: $adminAddress); exit(); } -- 21:50:04 up 2 days, 9:07, 0 users, load average: 0.92, 0.37, 0.18 - Lic. Martín Marqués | SELECT 'mmarques' || Centro de Telemática| '@' || 'unl.edu.ar'; Universidad Nacional| DBA, Programador, del Litoral | Administrador - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] array_pop() with key-value pair ???
Robin Vickery wrote: On 16/02/07, Eli [EMAIL PROTECTED] wrote: Hi, Why isn't there a function that acts like array_pop() returns a pair of key-value rather than the value only ? Reason is, that in order to pop the key-value pair, you do: ?php $arr = array('a'=1,'b'=2,'c'=3,'d'=4); $arr_keys = array_keys($arr); $key = array_pop($arr_keys); $value = $arr[$key]; ? I benchmarked array_keys() function and it is very slow on big arrays since PHP has to build the array. benchmark this: end($arr); list($key, $value) = each($arr); Thanks! that benchmarks with normal speed.. :-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: array_pop() with key-value pair ???
Mikey wrote: I guess you have tried foreach? foreach ($array as $key = $value) { ... } No.. loop should not be necessary when you want to take only the first or the last element in the array. Better using array_pop() array_shift() reset() end() and each() functions for better run times. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Session Problem
Also, make sure the session's are being saved properly. I had this same problem when PHP wasn't able to write to the temp directory. You can set up your own sessions dir with session.save_path in php.ini LoneWolf [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I am having a problem where it appears that the session is not being saved properly. While on a page, I can start a session and set variables to it. however, when I go to the next page.. the session variables appear to have been cleared out. first page: session_start(); $_SESSION[user_level] = test; second page: session_start(); echo $_SESSION[user_level] ; We just installed php on the 2003 server. Is there maybe a problem with the php.ini file that I need to fix? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] plugging gmmktime value into gmdate yields incorrect date
Jim Lucas wrote: Brad Fuller wrote: -Original Message- From: Brad Fuller [mailto:[EMAIL PROTECTED] Sent: Thursday, February 15, 2007 3:48 PM To: 'Terra Frost'; 'Peter Lauri' Cc: php-general@lists.php.net Subject: RE: [PHP] plugging gmmktime value into gmdate yields incorrect date -Original Message- From: Terra Frost [mailto:[EMAIL PROTECTED] Sent: Thursday, February 15, 2007 3:20 PM To: Peter Lauri Cc: php-general@lists.php.net Subject: Re: [PHP] plugging gmmktime value into gmdate yields incorrect date date('Z') on the server producing the incorrect output returns 3600. On the other two, I get -18000 and -21600. That said, I don't see how that'd make a difference. The whole reason I'm using the gm* functions, in the first place, is because those are supposed to work with a fixed timezone - GMT. Testament to this is the fact that gmdate('Z') returns 0 on all three of those. Peter Lauri wrote: And what are the time zones for those two different machines? And what is the time? :) Best regards, Peter Lauri www.dwsasia.com - company web site www.lauri.se - personal web site www.carbonfree.org.uk - become Carbon Free -Original Message- From: Terra Frost [mailto:[EMAIL PROTECTED] Sent: Thursday, February 15, 2007 8:47 PM To: php-general@lists.php.net Subject: [PHP] plugging gmmktime value into gmdate yields incorrect date I tried running the following script on three different servers: ?php echo gmdate('m, d, Y', gmmktime(0,0,0,3,23,2000) ); ? On two of the servers, I got 03, 23, 2000 back. On the other, however, I got 03, 22, 2000. This doesn't make any sense to me. On the servers that return the correct date (03, 23, 2000), gmmktime(0,0,0,3,23,2000) returns 953769600. On the server that returns the incorrect date (03, 22, 2000), gmmktime(0,0,0,3,23,2000) returns 953766000. There's a difference of 3600 between the two, which makes me think that some daylight savings time setting is to blame. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php I may be way off... but isn't it redundant to use both gmdate() and gmmktime()? I thought each of these functions were used to convert your local time into GMT... So for example if you're GMT+5, the gmmktime() would subtract 5 hours, and then gmdate() would subtract another 5 hours? Like I said - I could be way off, but just a thought. -Brad Yes, I was a little off... gmmktime() takes a GMT date and converts it to a local unix timestamp. gmdate() takes a local unix timestamp and converts it to a GMT date. So in theory you *should* get the same date you put in, if using both functions like your example. I think you are on the right track with the Daylight Saving time issue. Starting this year, DST in the U.S. begins in March instead of April. Given that the year of your date input is 2000, it shouldn't be affected, but perhaps that is in fact the culprit? Your date 3/23 falls in between the previous and future DST start dates. Hmm... Have you gotten similar results using a different month/day? -Brad if you run: echo gmdate('I', gmmktime(0,0,0,3,23,2000) ); //Capital 'i' I (capital i) - 1 if Daylight Savings Time, 0 otherwise. This might help you I got 0 on all three servers (even the one that's giving the incorrect dates). According to php.net, though, daylight savings time settings shouldn't make a difference: is_dst: Parameters always represent a GMT date so is_dst doesn't influence the result. I tried to play around with that setting, all the same. On the server that was reporting a date that was a day off (which is running PHP 4.1.2 on Sun Solaris), gmmktime(0,0,0,3,23,2000,1) gave the correct answer. gmmktime(0,0,0,3,23,2000,0) gave the incorrect answer. On one of the servers that gave the correct answer (running PHP 4.4.3 on some distro of Linux), gmmktime(0,0,0,3,23,2000,0) gave the correct answer and gmmktime(0,0,0,3,23,2000,1) gave the incorrect answer. On the last server (running PHP 4.4.4 on Windows), the last parameter doesn't make a difference. It returns the correct answer regardless. Making them all run on the same version of PHP would be nice, but two of the three are on shared hosts which I have no real influence over. Besides, I'd prefer to have this yield the same results on all three of those servers - to be as cross-server compliant as possible. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Session problems with 4.4.5?
Ken Williams wrote: Is anyone else having problems with session in 4.4.5? I'm under apache 1.3.27 in linux 2.4.34 and all my web sites break under 4.4.5. As soon as a page tries to register a session variable with session_register apache will segfault. Has worked perfectly fine for the past 2 years and like 10 version of PHP 4.4.X. segfault probably indicates problem. goto bugs.php.net and file a bug with details about your machine and a small reproduce script. side note: use of session_register() is not recommended - reading the following page may help you understand why, help you work around your current problem and hopefully get you on the path of using $_SESSION: http://php.net/session_register [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] reverse http authentication
I want to read a page that is protected with http authentication. How do I pass the user name and password to be authenticated with my php code? -- Chris W KE5GIX Protect your digital freedom and privacy, eliminate DRM, learn more at http://www.defectivebydesign.org/what_is_drm; Gift Giving Made Easy Get the gifts you want give the gifts they want One stop wish list for any gift, from anywhere, for any occasion! http://thewishzone.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Quick organizational question...
Hi! Question: For a website that will have a database driven store, articles, an rss feed, and a few other things... not an enormous site, but one with growth potential, does it makes sense to organize the whole thing as includes through a single main page? It seems like a fun way to do things, but I was just wondering what you all thought. BTW- It's my first time here! Hello world! -- Mike Shanley ~you are almost there~ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Unable to compile php 5.2.1 on Intel Macbook
Hello all, I can't compile php 5.2.1. I don't exactly know where the error starts or begins so I'm just going to post the whole thing: gcc -I/usr/include -g -O2 -L/usr/local/mysql/lib -L/usr/local/mysql/lib ext/libxml/libxml.o ext/pcre/pcrelib/pcre_chartables.o ext/pcre/pcrelib/pcre_ucp_searchfuncs.o ext/pcre/pcrelib/pcre_compile.o ext/pcre/pcrelib/pcre_config.o ext/pcre/pcrelib/pcre_exec.o ext/pcre/pcrelib/pcre_fullinfo.o ext/pcre/pcrelib/pcre_get.o ext/pcre/pcrelib/pcre_globals.o ext/pcre/pcrelib/pcre_info.o ext/pcre/pcrelib/pcre_maketables.o ext/pcre/pcrelib/pcre_ord2utf8.o ext/pcre/pcrelib/pcre_refcount.o ext/pcre/pcrelib/pcre_study.o ext/pcre/pcrelib/pcre_tables.o ext/pcre/pcrelib/pcre_try_flipped.o ext/pcre/pcrelib/pcre_valid_utf8.o ext/pcre/pcrelib/pcre_version.o ext/pcre/pcrelib/pcre_xclass.o ext/pcre/php_pcre.o ext/zlib/zlib.o ext/zlib/zlib_fopen_wrapper.o ext/zlib/zlib_filter.o ext/ctype/ctype.o ext/curl/interface.o ext/curl/multi.o ext/curl/streams.o ext/date/php_date.o ext/date/lib/astro.o ext/date/lib/dow.o ext/date/lib/parse_date.o ext/date/lib/parse_tz.o ext/date/lib/timelib.o ext/date/lib/tm2unixtime.o ext/date/lib/unixtime2tm.o ext/dom/php_dom.o ext/dom/attr.o ext/dom/document.o ext/dom/domerrorhandler.o ext/dom/domstringlist.o ext/dom/domexception.o ext/dom/namelist.o ext/dom/processinginstruction.o ext/dom/cdatasection.o ext/dom/documentfragment.o ext/dom/domimplementation.o ext/dom/element.o ext/dom/node.o ext/dom/string_extend.o ext/dom/characterdata.o ext/dom/documenttype.o ext/dom/domimplementationlist.o ext/dom/entity.o ext/dom/nodelist.o ext/dom/text.o ext/dom/comment.o ext/dom/domconfiguration.o ext/dom/domimplementationsource.o ext/dom/entityreference.o ext/dom/notation.o ext/dom/xpath.o ext/dom/dom_iterators.o ext/dom/typeinfo.o ext/dom/domerror.o ext/dom/domlocator.o ext/dom/namednodemap.o ext/dom/userdatahandler.o ext/exif/exif.o ext/filter/filter.o ext/filter/sanitizing_filters.o ext/filter/logical_filters.o ext/filter/callback_filter.o ext/ftp/php_ftp.o ext/ftp/ftp.o ext/hash/hash.o ext/hash/hash_md.o ext/hash/hash_sha.o ext/hash/hash_ripemd.o ext/hash/hash_haval.o ext/hash/hash_tiger.o ext/hash/hash_gost.o ext/hash/hash_snefru.o ext/hash/hash_whirlpool.o ext/hash/hash_adler32.o ext/hash/hash_crc32.o ext/iconv/iconv.o ext/json/json.o ext/json/utf8_to_utf16.o ext/json/utf8_decode.o ext/json/JSON_parser.o ext/ldap/ldap.o ext/mbstring/oniguruma/regcomp.o ext/mbstring/oniguruma/regerror.o ext/mbstring/oniguruma/regexec.o ext/mbstring/oniguruma/reggnu.o ext/mbstring/oniguruma/regparse.o ext/mbstring/oniguruma/regenc.o ext/mbstring/oniguruma/regext.o ext/mbstring/oniguruma/regsyntax.o ext/mbstring/oniguruma/regtrav.o ext/mbstring/oniguruma/regversion.o ext/mbstring/oniguruma/st.o ext/mbstring/oniguruma/enc/unicode.o ext/mbstring/oniguruma/enc/ascii.o ext/mbstring/oniguruma/enc/utf8.o ext/mbstring/oniguruma/enc/euc_jp.o ext/mbstring/oniguruma/enc/euc_tw.o ext/mbstring/oniguruma/enc/euc_kr.o ext/mbstring/oniguruma/enc/sjis.o ext/mbstring/oniguruma/enc/iso8859_1.o ext/mbstring/oniguruma/enc/iso8859_2.o ext/mbstring/oniguruma/enc/iso8859_3.o ext/mbstring/oniguruma/enc/iso8859_4.o ext/mbstring/oniguruma/enc/iso8859_5.o ext/mbstring/oniguruma/enc/iso8859_6.o ext/mbstring/oniguruma/enc/iso8859_7.o ext/mbstring/oniguruma/enc/iso8859_8.o ext/mbstring/oniguruma/enc/iso8859_9.o ext/mbstring/oniguruma/enc/iso8859_10.o ext/mbstring/oniguruma/enc/iso8859_11.o ext/mbstring/oniguruma/enc/iso8859_13.o ext/mbstring/oniguruma/enc/iso8859_14.o ext/mbstring/oniguruma/enc/iso8859_15.o ext/mbstring/oniguruma/enc/iso8859_16.o ext/mbstring/oniguruma/enc/koi8.o ext/mbstring/oniguruma/enc/koi8_r.o ext/mbstring/oniguruma/enc/big5.o ext/mbstring/oniguruma/enc/utf16_be.o ext/mbstring/oniguruma/enc/utf16_le.o ext/mbstring/oniguruma/enc/utf32_be.o ext/mbstring/oniguruma/enc/utf32_le.o ext/mbstring/oniguruma/enc/gb18030.o ext/mbstring/libmbfl/filters/html_entities.o ext/mbstring/libmbfl/filters/mbfilter_7bit.o ext/mbstring/libmbfl/filters/mbfilter_ascii.o ext/mbstring/libmbfl/filters/mbfilter_base64.o ext/mbstring/libmbfl/filters/mbfilter_big5.o ext/mbstring/libmbfl/filters/mbfilter_byte2.o ext/mbstring/libmbfl/filters/mbfilter_byte4.o ext/mbstring/libmbfl/filters/mbfilter_cp1251.o ext/mbstring/libmbfl/filters/mbfilter_cp1252.o ext/mbstring/libmbfl/filters/mbfilter_cp866.o ext/mbstring/libmbfl/filters/mbfilter_cp932.o ext/mbstring/libmbfl/filters/mbfilter_cp936.o ext/mbstring/libmbfl/filters/mbfilter_euc_cn.o ext/mbstring/libmbfl/filters/mbfilter_euc_jp.o ext/mbstring/libmbfl/filters/mbfilter_euc_jp_win.o ext/mbstring/libmbfl/filters/mbfilter_cp51932.o ext/mbstring/libmbfl/filters/mbfilter_euc_kr.o ext/mbstring/libmbfl/filters/mbfilter_euc_tw.o ext/mbstring/libmbfl/filters/mbfilter_htmlent.o ext/mbstring/libmbfl/filters/mbfilter_hz.o ext/mbstring/libmbfl/filters/mbfilter_iso2022_kr.o ext/mbstring/libmbfl/filters/mbfilter_iso8859_1.o ext/mbstring/libmbfl/filters/mbfilter_iso8859_10.o
[PHP] easynav breaks my page
I am using the easynav class. I include it like this ?php include('../classes/easynav.php');? without it in my page validates 0 errors 0 warnings and dispalys fine, however when I stick it in I get a few missing div errors and the page breaks. It would be a shame not to use it as it is a great script. Does the script add any div tags or anything? Here is my navigation that is inserted. div class=middle div class=top div class=bottom ul id=contact_side lia href=one.phpone/a/li lia href=two.phptwo/a/li lia href=three.phpthree/a/li /ul /div /div /div thanks, Ross -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Quick organizational question...
Hi, No matter the size of a project using includes and config files are always a good way to go. In the include file I would (as it states) include all main files that are common for all pages. Such as a DB class (if common), template classes, etc. In the config file (or you can call it define file) I would define all constants that might be used. Such as: define(ROOTDIR, /wherever/your/webroot/is); define(CLASSDIR, ROOTDIR . /classes); //not the best way, I usually keep my classes out of the webroot define(DB_HOST, localhost); Or you can have a txt config file config.cfg ROOTDIR /wherever/your/webroot/is CLASSDIR [ROOTDIR]/classes And then you just have to read and parse that with a general define script :) Something like this (don't have the code here, so I try it anyways). ?php $configcontent = file_get_contents(config.cfg); $lines = explode(\n, $configcontent); foreach($lines AS $line) { $line = trim($line); if(preg_match(/^[A-Z_]+\s+.+$/, $line)) { $linemodified = preg_replace(/^([A-Z_]+)\s+(.+)$/,$1:$2,$line); list($const, $value) = explode(:, $linemodified, 2); define($const, $value); } } ? Best regards, Peter Lauri www.dwsasia.com - company web site www.lauri.se - personal web site www.carbonfree.org.uk - become Carbon Free -Original Message- From: Mike Shanley [mailto:[EMAIL PROTECTED] Sent: Saturday, February 17, 2007 5:06 AM To: php-general@lists.php.net Subject: [PHP] Quick organizational question... Hi! Question: For a website that will have a database driven store, articles, an rss feed, and a few other things... not an enormous site, but one with growth potential, does it makes sense to organize the whole thing as includes through a single main page? It seems like a fun way to do things, but I was just wondering what you all thought. BTW- It's my first time here! Hello world! -- Mike Shanley ~you are almost there~ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php