Re: [PHP] link problem
Try something like realpath( dirname(__FILE__)."../" ); __FILE__ should give you the full path of the file being run, dirname() will break the directory path from it and ../ will drop it down one dir ... real path will give you a solid final path. ~Drew On 7/31/06, Ross <[EMAIL PROTECTED]> wrote: I have lots of folders and files some are in the main public_html folder and some are in their own foder. I need to find a way to make all the links relative to the public_html folder For example if I am in the 'gallery' folder, the main index file is located at ../index, however if I om in the contact page which is in the same directory as index the link is just index.php. I want to have one menu and make all the links work without having to enter a full http://www.mydomain/myfolder/myfile.php. I tried $_SERVER['doc_root']; but this gives the full server root. I am sure I have see a way to define directorries using define() or something. Ta. -- 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
[PHP] PEAR DB nextId() sequences
Hey guys, Just had a quick question for anyone out there. I've been using PEAR's DB object for quite a while, as I have to simultaneously work with both MySQL and PostgreSQL. Currently I use the nextID() method to find new IDs for the rows that I insert, but am running into an issue with its sequence tables. The fact that it generates a table for every corresponding sequence is becoming unbearable, as it is seriously cluttering my databases. I was wondering if anyone knew of a PEAR hack out there that might push all of these sequences into a single table that has the sequence name as a second row. I'm on the verge of doing this myself, but am hoping for a better solution, as I would rather not have to break PEAR. Any thoughts on how others have tackled this issue ? It just seems silly to me that they did not make the sequences behave in a nicer way when they designed this system. I would much rather see something like a `pear_sequences` table then an extra 4 dozen tables. Thanks. ~Drew
Re: [PHP] php / mysql / js search result question
You're right when you say this has nothing to do with PHP. Well, mostly right. I don't believe he is looking for a select box solution. I believe what is being looked for is a Google Suggest style input box auto-complete solution. Now you were right to say this is heavily dependant on JavaScript or Flash (though flash would be a very bad soultion for this). Check out this link: http://www.papermountain.org/demos/live/ It contains a tutorial for developing a JavaScript XMLHTTPRequest style auto-complete input box. In fact, the liveUpdater tool that he uses is so good that I ended up using it as a model for my own AJAX toolkit. On 12/30/05, Richard Lynch <[EMAIL PROTECTED]> wrote: > > On Tue, December 27, 2005 2:03 am, Dave Carrera wrote: > > I have a very long list of customer names which i know is easy to get > > from a mysql result using php, no prob there. > > How long is very long?... > > > But what i would like to do is offer input box and when the user > > enters > > a letter, i think this will require client side onchange(), the full > > list, i think might be in an iframe, will move to the first instance > > of > > user input. > > > > Example: > > > > 1 Alpha Customer > > 2 Apple Customer > > 3 Beta Customer > > 4 Crazy customer > > 5 Doppy customer > > > > User input is "a" so the list moves to first instance of "a". User > > continues to input "ap" so the list moves to "2 Apple Customer" and so > > on. > > *IF* your visitor is using a decent browser and OS, then that's > EXACTLY how this works: > > > Alpha Customer > Apple Customer > . > . > . > > > On crappy systems, only the FIRST letter they type "counts". So they > can jump to "A" but not to "Ap" for Apple. Ugh. > > But you should not be dumping a VERY long list to the browser -- > Anything more than a few hundred (and that's pushing it) should > probably not be in a list of choices. > > I've got one such list with 2000 in it, but ONLY for an Intranet where > I know it's always high-bandwidth and trusted/trained users. > > At any rate, this is all browser side, and so it has NOTHING to do > with PHP. > > You'll need to research JavaScript and Flash choices to get on to the > browser side of things. > > I've also had good luck with giving an 'a b c d e ... z' and paging > navigation for larger sets. Up to a point. > > At some point, you really do need to have a search input box and go > from there. > > -- > Like Music? > http://l-i-e.com/artists.htm > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >
Re: [PHP] PHP4 vs PHP5
A simplified version of this would be: $glb_http_ref = isset( $_SERVER['HTTP_REFERER'] ) ? $_SERVER['HTTP_REFERER'] : ""; or just: $glb_http_ref = @$_SERVER['HTTP_REFERER']; The latter will suppress the error message and return a null (or a blank as far as PHP is concerned. Not the cleanest route and I prefer the first method, but just thought I would get some options out there. :) On 1/7/06, Gerry Danen <[EMAIL PROTECTED]> wrote: > > On 1/7/06, Kevin Waterson <[EMAIL PROTECTED]> wrote: > > > > This one time, at band camp, Gerry Danen <[EMAIL PROTECTED]> wrote: > > > > > I'm wondering if $_SERVER['HTTP_REFERER'] is no longer supported, or > > perhaps > > > has a new name? > > > > still there, same name. > > > > print_r($_SERVER); > > > Ah, yes. It's there when the page is actually referred from somewhere, > otherwise it's not. > > Thanks, Kevin. > > Now my simple assignment becomes a conditional assignment to avoid clutter > in the error log: > > if ( isset($_SERVER['HTTP_REFERER']) ) > $glb_http_ref=$_SERVER['HTTP_REFERER']; > else > $glb_http_ref=""; > > instead of > > $glb_http_ref = $_SERVER['HTTP_REFERER']; > > Learning as I go... :) > > Gerry > >