-
Posts
1,832 -
Joined
-
Last visited
-
Days Won
3
Everything posted by salathe
-
Why is there a semi-colon on the line with preg_match ?
-
Hi zontrakulla, please refer to the first two numbered points on the handy (3 point) list at http://php.net/reference.pcre.pattern.posix In short, read that page and use delimiters and the case-insensitivity pattern modifier.
-
The best plan is to use a two-stage process: $modDB = new modDB; $salt = $modDB->getPwdSalt(); echo $salt[1]; There are other options, ranging from awesome (but unusable) to dirty! Here's the awesome (I'll leave the dirty for someone else to post) : // Currently only available in the bleeding edge, development version of PHP // See http://wiki.php.net/rfc/functionarraydereferencing $modDB = new modDB; echo $modDB->getPwdSalt()[1];
-
Alternatively, go back to basics with: for ($i = 1; $i <= 5; $i++) { echo "$i<br>\n"; }
-
Use one of the many mirrors, e.g. http://docs.php.net/callback
-
What specific part are you having trouble with? You store all of the necessary information to reconstruct the status URL. There are two main tasks, make a URL string and output it as a HTML link.
-
There are many ways of writing XML in PHP, could you take a look over some and see which you like most. For your needs, they're all about as easy to get started with as each other. So, for reference: Document Object Model (DOM) http://php.net/dom SimpleXML http://php.net/simplexml XML Writer http://php.net/xmlwriter And for getting the file name without the extension, you could a) get the file extension, then b) use $file->getBasename($ext).
-
Please give an example of the XML that you would like to output.
-
Can you outline what you're trying to do? You mention lots of things but not what's going on.
-
Also, older SimpleXML versions didn't like to play nicely with CDATA so it might be work looking into the DOM classes.
-
You cannot echo text and an image in the same response.
-
Can you show us an example showing that none of the CDATA text is available?
-
Don't use LIBXML_NOCDATA as that merges CDATA content into XML text nodes, which is why you see the "HTML entity equivalents".
-
Why do I keep getting this error? Please help.
salathe replied to morbidangel2012's topic in PHP Coding Help
To make the syntax valid, sure. To make it work, no. Go ask your friend to give you something that isn't horribly broken. -
What kind of statistics are you looking to work with?
-
Why do I keep getting this error? Please help.
salathe replied to morbidangel2012's topic in PHP Coding Help
Could you point out the if (...) { which correlates to the //foot start } else { code? -
Why do I keep getting this error? Please help.
salathe replied to morbidangel2012's topic in PHP Coding Help
Is that all of the code? -
Why do I keep getting this error? Please help.
salathe replied to morbidangel2012's topic in PHP Coding Help
The error was stated to be on line 261... you have shown us 10 lines. To help us to help you, can we see the other 251+ lines in the file? Without seeing those, it looks like the original error might be due to the } below the foot start comment but that would be pure guess-work. -
You can use some of the string functions to take away the parts that you don't want, basename to remove the .mp3 and/or maybe a regular expression to do everything at once, if you've used those before.
-
You could also use parse_str to make sense of the query string. $url = 'http://domain.com/gallery/?album=3&gallery=65'; // album=3&gallery=65 $query_str = parse_url($url, PHP_URL_QUERY); // array('album' => '3', 'gallery' => '65'); parse_str($query_str, $query_arr); // outputs: 3 echo $query_arr['album']; That could be mushed on to one line, for you to echo as you want: <?php parse_str(parse_url(getPageURL(), PHP_URL_QUERY), $query_arr); ?> Back to <a href="http://domain.com/gallery/?album=<?php echo urlencode($query_arr['album']) ?>">gallery</a>
-
The ids are assigned to the variable in that code. You just cannot echo an array using echo()... either loop over the values and echo() one at a time, or use print_r/var_dump if you just want to see what $ids contains.
-
You could just use the file function to put each line of the file into an item within an array like: $ids = file('your_text_file.txt', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); The two FILE_*_LINES "flags" are used to trim new lines (which would ordinarily be appended to each item in the array) and to skip any empty lines, respectively.
-
Recursive Iterator Iterator Tree problem ??
salathe replied to lostnucleus's topic in PHP Coding Help
I give up. If you're not willing to read what people are saying when they're helping you, then there is really no point in trying. -
phoenixx, your HTML sample is missing a few details (like the username/password fields!) and without more details we can't help you with targetted answers. Can we see the full HTML? Even better then that would be a trace of the HTTP headers/content from the requests and responses when logging in and accessing the password-protected page. For what it's worth, you almost certainly (barring anything really crazy) could do what you want with file_get_contents() even if some folks in this thread say otherwise.
-
Recursive Iterator Iterator Tree problem ??
salathe replied to lostnucleus's topic in PHP Coding Help
The "missing" part to get the exact same array as in your first post is a super-simple change to the example that I gave to get the ball rolling. That is, if I'm understanding your exclamations correctly: it is very difficult to decipher what you want as you're really not being clear (whether you know that or not). The function that I gave follows the structure (except for the root item, which doesn't make a whole lot of sense to include that special case) as you described it and I'm not at all sure what you mean by it needing "to follow same hierarchy structure as that of direcorty [sic] iterator !! children key of array acts as a subfolder !!" Your impatience is tiresome. Wait for replies or you certainly will not be getting any more. Anyway, it doesn't take a genius to help you; please set the bar a little lower.