premiso
Members-
Posts
6,951 -
Joined
-
Last visited
-
Days Won
2
Everything posted by premiso
-
<?php $json = '{ "errorCode": 0, "errorMessage": "", "results": { "http://www.n8w.com/image/art/witchcraft/": { "hash": "IB0iS", "shortKeywordUrl": "", "shortUrl": "http://bit.ly/e4miJ", "userHash": "e4miJ" } }, "statusCode": "OK" }'; $obj = json_decode($json); echo $obj->results->{"http://www.n8w.com/image/art/witchcraft/"}->shortUrl . "<br />"; echo "<pre>"; print_r($obj); die(); ?> If you did a dump of the object you would notice that it listed under the actual url: Output from the above: http://bit.ly/e4miJ stdClass Object ( [errorCode] => 0 [errorMessage] => [results] => stdClass Object ( [http://www.n8w.com/image/art/witchcraft/] => stdClass Object ( [hash] => IB0iS [shortKeywordUrl] => [shortUrl] => http://bit.ly/e4miJ [userHash] => e4miJ ) ) [statusCode] => OK )
-
http://www.phpfreaks.com/forums/index.php/topic,117475.0.html Sticky at the top of the Misc forum.
-
Just a note, I cannot edit my post unfortunately. I mixed up two threads, so the $extension portion was not meant for here, so please disregard that Too many tabs opened.
-
parse_url Maybe of some assistance to you.
-
<?php $string = "The quick %%BROWN%% Fox jumped %%BACK%% and %%2FRONT%%"; preg_match_all("~%%([A-Z0-9]+)%%~", $string, $result); var_dump($result); die(); ?>
-
Yes, but Drupal is a 3rd party script. PHP Help is generally for scripts you make that need fixing. You provided no code to us what so ever and expect us to blindly fix your code. If it is Drupal, which I doubt ken would be wrong, then that seems like an issue for them as it may be a bug or the module you added was flawed. It seems that $extension is never being set, which would be causing the issue cause it cannot tell what image function to use on the image. This could be due to many reasons, the most prominent if it just started happening and you changed or upgraded php, register_globals may have been turned off (which it should stay off). But as I said, I am assuming and you know what assuming does. It makes an ass out of u and me. Give us more information or talk with the Drupal people. Simple as that.
-
preg_match Regular Expressions is where you want to go. <?php if ($source = file_get_contents("http://help.websiteos.com/websiteos/example_of_a_simple_html_page.htm")) { $search = "~<h1>(.*)</h1>~s"; preg_match($search, $source, $match); echo $match[1]; } else { echo "error"; } ?>
-
....seriously? I never knew that...time for some experiments now
-
Chances are the type is wrong. <script type="text/javascript"> Change it to that and see what happens.
-
Is error reporting on? Are you sure that myfile.php is being loaded and read and that it is in the same directory as the script you are running? It seems to me that myfile.php is not being ran for whatever reason and error reporting may be set to low or display errors is turned off. Paths do matter for including files.
-
<?php // mysql_connect information here $postSql = "SELECT post_id FROM table ORDER BY date DESC LIMIT 10"; $postResult = mysql_query($postSql) or die("SQL Was: {$postSql} <br />Error: " . mysql_error()); $postIds = array(); while ($row = mysql_fetch_assoc($postResult)) { $postIds[] = $row['post_id']; } $postIds = implode(", ", $postIds); $ascSql = "SELECT * FROM table WHERE post_id IN({$postIds}) ORDER BY date ASC"; $ascResult = mysql_query($ascSql) or die("SQL Was: {$ascSql} <br />Error: " . mysql_error()); while ($row = mysql_fetch_assoc($ascResult)) { $posts[] = $row; // or do your displaying information here. } ?> It is a bit more work then being able to do a subquery. But if you do not have that option, I do not know if there is another way. The above code will not just "work" you will have to modify the SQL table name and also provide the sql connection and manipulate the data in the asc portion to display/be stored how you want it to be.
-
Not sure on rtf and how that really works, but maybe it needs \r\n and not just \n. I would try that and see where that gets you.
-
It might be easier if you use html_entity_decode on the string then do a replace of the actual tags instead of having to use the entity version. Since you have many tags that you do not want filtered out, strip_tags probably would not work for you. Anyhow, hope that helps you get it sorted easier/better. As far as a simpler way, I do not think there is, but that might make it cleaner since it will be <b> instead of & ...etc
-
Just out of curiosity, it seems like you are testing if a file exists? Maybe glob will help you. Given that no code was shown, I do not know. But that may be what you are after in the first place So I thought I would point that out.
-
Variable context/scope is only used in Classes/OOP in php as far as I know (public private etc) As classes can distinguish/hide that information. PHP on it's own without the use of the class cannot really distinguish it. Why he does not see the error, chances are his error levels are lower than yours and it is indeed throwing an error. It is just hidden.
-
It sounds like you need a new web developer. You do not need ajax, it would just require a page reload for the filter, as CV suggested. If you do not want a page reload, that is your preference and AJAX would be required, but where do you think AJAX would be getting it's information from? PHP and MySQL. It sounds to me that the developer just does not know PHP/MySQL and is trying to back out of this job or learning the proper method. You can do this with flat files, but you are already using joomla (which I have never used) you might as well use MySQL as it will be quicker and better in the long run. As stated you are getting fed crap from this developer, either they do not know what they are doing or do not want to do it. Honestly, it sounds like an easy thing to do, as jack has showed. You have a table with the terms and definitions then an input field on a form use that with the MySQL Like clause to find the term and viola. You have the definition. Honestly it would/should take less than an hour to actually code (not including the methodology/structure of the sql). If you want it as a joomla module, it may take longer depending on how much knowledge of that system you/your developer have. This is just my opinion. Jack's example above seems to be exactly what you were looking for. You will need to create a terminology table, as suggested, and add the terms/definitions to it. That will not search the whole site, it will only search that table as it should be defined that way in the query. Where your developer is coming with that searching the whole site, I have no clue.
-
<?php $string = " nm</td><td class=results width=50 style='align:center'><a href='?site=pl&show=700579c68127f8f25825b1efb8c2f56d' class='link'>details</a></td></tr> asdfasf"; $filtered2 = preg_replace("~ nm.*?&show=(.*?)' .*?</tr>~is", "", $string); var_dump(htmlentities($filtered2)); die(); ?> I would suggest going with preg_replace instead.
-
Subquerys only work in MySQL 4 and above. Chances are you are using MySQL 3.23 as that was the most popular version prior to 4+. You will have to do 2 separate query's using the results to get this to work for you. Or use the array for sorting, although depending on what the date is stored as that might be tricky
-
What is your goal for doing this? Just out of curiosity. If it is for SEO reasons...well that can get you banned from google. As far as doing it look into Addon Domains, as that is what this would be considered. Your host may support/offer the addon domain to you.
-
set_time_limit Have you tried increasing the timeout limit of PHP. Chances are PHP is just timing out after the normal time like it is suppose to.
-
Mail PHP Manual Check out the 4th example. For a true CC you need to add it as a header as seen there. Separating the $to email by commas will send it to multiple addresses. Whichever you want to do.
-
My name is Jim...and that is all I have to say about that.
-
You can always do a 301 redirect at the subdomain via .htaccess to the new domain. That will tell any bots to use the new address etc. Probably the best way to do it.
-
This seems too simple, but did you try to use is_dir for your if statement to see if the directory is already there ???