Jump to content

FredAt

Members
  • Posts

    12
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

FredAt's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hello All, I need to take an XML document, modify some of the nodes in it and then perform a selective reordering of a subset of nodes. The modification I have done without too much difficulty - extracting the current node as nodeValue, operating on the nodeValue to generate a new node with the desired structure and then replaceChild to replace the old node. However, when I looked at reordering I hit a stumbling block. Much to my surprise I found that there appear to be no methods of DOMNode/DOMElement/DOMDocument to help me do the reordering. I thought I would first take out the nodes that require reordering and then add them back in. And then I found that on my local installation (PHP 5.2) last_child and lastChild both produced error messages. Am I barking up the wrong tree here? Do I need to look at something other than DOMDocument? I'd hugely appreciate any help.
  2. Is there a PHP way to do the equivalent of the following Delphi snippet with someObject do begin x:=objPropA;//some stuff with objPropA end; Apart from reducing the verbosity of code it also reduces the possibility of typo errors. The best I have managed is to convert the object to an array and then refer to the associative elements in the array. This works for me because I ensure that I am only handling simple PHP objects - i.e. ones which do not have objects as properties in turn. However, given just how neat PHP is I am sure that there is a better way. I'd appreciate any pointers.
  3. Thanks. Rule 1 (which I know well and break often) - never work beyond the point of uttter fatigue. I started off by forgetting to create the safe SQLite database directory. Then I had too many slashes. Then I tested locally and got it right, uploaded to my Linux server and found it did not work. Eventually I realized that it was not liking my \ slashes and expected / slashes instead. Enough for today!
  4. Hello All, This is probably a very basic question but I cannot for the life of me figure out how to correctly refer to a file located above the document root. $path = $_SERVER['DOCUMENT_ROOT'].'/../fldr_name/file.name'; is not giving the correct result. In answer to the inevitable question - I want to store a SQLite database in a folder above the server root for security. Naturally, I will need to access the file from some of my PHP scripts. I am sure I have done this before and it has worked. Maybe it is just late in the day or maybe I am plain thick :'(. I'd appreciate any help.
  5. Thank you for the replies guys - including the smartarse ones. I guess it is just so much easier making mean comments rather than actually trying to read, understand and reply. The answer is this - ini_set, set_error_handler etc can only trap error reporting if the script gets loaded and interpreted. If for any reason whatsoever this does not happen then evidently default PHP error reporting will kick in. The right way to stop this is by setting display_errors = Off in php.ini.
  6. How can I completely kill the - oh, so helpful! - PHP error messages from being sent back to the browser? I have played around with set_error_handler and followed the guidelines in the docs but to no avail. Maybe I am doing something wrong. Perhaps there is a clear tutorial on how to deal with this somewhere out there?
  7. I have just discovered that the cookie I am attempting to set via a PHP script is not being set in IE6 - and perhaps in IE7. It all works just fine when I test from localhost but not when my site goes live. I have come across all kinds of explanations for this - including one rather garbled one about the need for at least two .s in the url. I use a rather exotic TLD - not one of the generics such as .com. Is there anything I can do at the PHP end to make things work the way they should? Are there any in-depth discussions of this issue I could read up on? I would much appreciate any help.
  8. I am planning to use PHP with SQLite to do so custom logging for one of my websites. The reccomendation from the folks on the SQLiute forums is that instead of writing directly to the DB I should cache the writes and do them in a batch since this will improve site access. OK - know how I would do that in Windows in a traditional programming language such as C++ or Delphi but I am fairly new to PHP so I need to ensure that I am still barking up the right tree. I can do either write all my SQL to a temporary text file or to a memory map using sh_mop and then run another PHP script to clean up the cache every few seconds/minutes. In both cases, I am suspect I need to do some work to ensure syncronization of reads/writes to my memory map/text file. In Windows I would simply use Windows Event objects. From what I have read thus far PHP does not offer Events. I could use the PHP semaphore functions but this is where I start getting confused. There is information on the net that suggests that sem_acquire will simply return false if the semaphore is in use by another process. But then there is also information that suggests that it will block. In the former case I would have to run a loop along with a usleep statement before writing my SQL or abandoning the effort. If sem_acquire actually blocks things get messier. I would rather abandon an occassional log entry rather than have the process lock because it cannot access a semaphore that has been blocked by another process that failed. I would be much obliged to anyone who could clarify these issues.
  9. Is there a way I can call a PHP script from SSI. I have a vague knowledge of the SSI exec command but have never used it. Also, not sure that web hosting services (mine is Lunar Pages) allow this. What I want to do is this - Call a PHP script from SSI Access the cookie passed in the request header from PHP along with the name of the requested document Use this information to update a SQLite database I would much appreciate any help.
  10. Thanks.  Yes, I have taken a look at both of these but neither really fits the bill.  I like - sometimes I get the feeling that I am the only one on the planet who still does - printable resources since I spend far too much time staring at computer screens anyway.  What I had in mind was something like the O'Reilly pocket references.  PHP probably has a wide range of exotic functions but - like  in any other languge what one uses most of the time is a relatively small subset.  When starting off, as I am, it helps to have a quick "how-to" guide to help do bread & butter stuff like variables, loops, function calls... . b.t.w - if the powers that be on this forum are reading, I have to say that you have one of the least legible captchas tht I have ever seen.  I have 20/20 vision but I had a tough time figuring out what the letters were.
  11. I have only just joined this forum having made the decision to ditch ASP in favor of PHP.  I am a very experienced C/C++/Delphi programmer and generally have no difficulty picking up a new language.  It would be a great help if I could have a brief printed quick reference to PHP5 at this stage.  There do not appear to be any books on the subject (and I mean something in the O'Reilly flavor not a massive resource wasting tome).  I would be much obliged to anyone who could point me to an online source of a PHP5 quick reference that is easily printable.  I insist on PHP5 since I want to use its integrated SQLite access features.
×
×
  • Create New...

Important Information

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.