-
Posts
1,832 -
Joined
-
Last visited
-
Days Won
3
Everything posted by salathe
-
Nah, I said you were using PHP 4 (you were!). Good to see you got it sorted.
-
You're using PHP 4 which does not use the __construct style of constructor. You should instead name the constructor method as Main: see http://php.net/oop4.constructor
-
Parsing an XML file (problems with spliting string)
salathe replied to novito's topic in PHP Coding Help
Are you sure that the values you posted above are exactly the right values? Everything being mushed together (var_dump output should be nicely formatted) suggests you're outputting as HTML which will cause HTML-like tags (i.e. XML) to be not displayed. Output the var_dumps as plain text (send the header('Content-Type: text/plain; charset=utf-8'); before var_dumping. If that's not relevant, please post a sample of the XML as previously requested. Use echo $xmlResponse->asXml(). -
Please in future, if you want anyone to help, be has helpful to us as possible. Even after being specifically asked for more details you still didn't say what you had tried (so we could fix it) nor did you pick it up and run when given a very strong hint towards an easy solution. You can split up the CSS selectors and declarations using strtok (looking for curly braces) like: $tok = strtok($subject, "{}"); while ($tok !== FALSE) { $toks[] = $tok; $tok = strtok("{}"); } That will simply give a long list of selector 1, declarations 1 … selector n, declarations n. If you want the parts in a different array structure (or, however you want them!) then you can change the tokenising process accordingly or work on that array, whichever suits your needs. Since this is in the regex forum here's a regex which also splits up the different parts: preg_match_all('/([^{]+){([^}]+)}/', $subject, $matches, PREG_SET_ORDER); Go wild.
-
Parsing an XML file (problems with spliting string)
salathe replied to novito's topic in PHP Coding Help
Please post the original XML file, it does look like you're mixing up variable names. -
Parsing an XML file (problems with spliting string)
salathe replied to novito's topic in PHP Coding Help
My guess is that you don't want to be using $prova in this line: $spliting = split(" ",$prova); as it looks to be the original XML string. Using the variable names in your post, you want to split on $test instead. -
Chances are that they're also recording which other videos other people came from (or went to) for videos you recently watched. Those can then be ranked and act as part of the recommendation engine. Whether that's the case or not, I'd recon the system in place on YouTube is pretty complex and non-trivial to recreate.
-
Back to your original problem, the BroadcastData is unneccessary: $xml->BroadcastData->ScheduleData // bad $xml->ScheduleData // good
-
Story 1 Eric (the owner of this site) found out that the staff took issue with various things (unimportant for this discussion) about how this site is managed and plan on starting a new (web development) forum on their own based on different foundations in the hope of avoiding the various things that are problematic here. Eric has no problem with the staff doing that. However, he figured (incorrectly) that the staff would (ab)use this site as a springboard (by messaging the list of members) to push members over to the other site. To prevent any such actions from taking place, Eric removed the privileges of most of the staff. Story 2 Who knows what causes a badge-eating badger to go on a badge eating rampage? Why do coloured badges prove more attractive, do they taste any different? Alas, only the badge-eating badger will ever truely know why it ate those badges and unless you can figure out a way to communicate with the beast, the reasons for it doing so will forever remain elusive.
-
What have you tried so far, and why isn't that good enough (or working)?
-
Parsing text file - Help with preg_match_all regex
salathe replied to thewired's topic in Regex Help
Sorry for the delay in replying, it is so easy to "lose" threads on this site! By something simpler, I just meant breaking up the subs text based on the line structure, like: $result = array(); foreach (explode("\n\n", $subs) as $item) { list($num, $timestamp, $sub) = explode("\n", $item, 3); $result[$num] = $sub; } print_r($result); Which outputs: Array ( [1] => My dear children, [2] => it is now better than several years since I moved to New York [3] => and I haven't seen you as much as I would like to. [4] => I hope you will come to this ceremony of Papal honours, ) -
Depends where you work. My bosses are pretty forgiving (lack of regular shaving, jeans and t-shirt/hoody) so long as we brush up for any important meetings. To bosses reading this, "you're awesome!"
-
Need help writing a SimpleXML Xpath expression correctly
salathe replied to Racoon's topic in PHP Coding Help
Go for it and see what happens. I haven't installed PHP on Windows for 5 or 6 years so won't be of much use if it doesn't work. -
Story 1 Eric (the site owner, you probably don't know him) came back and waved his demotion stick. He posted up a thread discussing the situation, and quickly removed it (he said it [the thread and the demotions] was maybe a mistake), leaving much of the previous staff group to sit in the alumni list. Story 2 The badgers ate everyone's badges and the staff alumni ones were all that was left (because they're dull and grey, not enticing to a badge-eating badger). Choose whichever story you wish to believe. They're both the God's honest truth!
-
Need help writing a SimpleXML Xpath expression correctly
salathe replied to Racoon's topic in PHP Coding Help
Racoon, I replied to your SO question after compiling PHP 5.0.5 myself to check things out. SimpleXML XPath is a bit whacky in that old version and much, much improved in later versions of PHP. -
Use \$DB_NAME Edit: see Variable parsing in double quoted strings in the PHP manual
-
You could use a string tokenizer to move through the string piece by piece. Take a look at the strtok function, let us know if it makes (no!) sense to you.
-
The event listener is bound to an individual element. When you repopulate the div, the old element is removed and new ones are added. They're entirely new, even if they share the same tags, names, ids. At that stage, you will need to add the event listener to the new submit button.
-
Considering that class does no cropping of the image whatsoever, whether it works or not is irrelevant. I would advise against copy/pasting code in answer to questions unless you know it will help.
-
Very much so. By way of analogy, would you consider the strings "ab" and "ba" to be identical?
-
Is there any reason you're converting to hex to decimal to binary and not just going straight to binary?
-
Unless you're willing to go along the route of how sites like codepad.org work, it might very well be an idea to abandon this particular project early especially if you want to keep your hosting account intact.
-
PHP itself uses primarily English terms (excepting a few things like the "paamayim nekudotayim" [the double-colon, ::, scope resolution operator]) however coming with PHP 6 is universal unicode support so it will be possible to write code using unicode characters. That said, I would confidently foretell that the vast majority of code will still be entirely English (except translations, comments, etc. like today).
-
We need to know precisely what you're doing at the moment to flag words as any help given could be incompatible with the way you're doing things. So, could you give an overview (code would be awesome) of the process you go through when searching the content? Edit: Thanks... I'll take a look and reply later if no-one else has.
-
PHP clock to show all visitors current time in a specific country
salathe replied to daring_du's topic in PHP Coding Help
That's right except that the time is taken from the server (you maybe meant "timezone of the server") and calculated to Kenya's time. If the server is a couple of seconds (or god forbid, minutes!) deviant from actual time, that difference will be reflected.