PHP - More Characters
First forgive me, I do not know if this is the correct forum for this question. I did not write the code but I have a feeling if its possible to correct it, then its probably coding.
My question is, is there anyway to post larger News articles to the homepage. I am trying to post an article that a friend sent from another site onto mine (giving the other site proper credit). But the article is apparently too big. I do not know how many characters the article is, or what the character limit is set by Nuke 8.0. Is there anything that I can do? Thanks..oh and congrats on apparently being the only active PHP forums :-S I have tried a few others and they haven't made posts since 2011. Anyways thanks in advance for any and all help. Similar TutorialsHi guys! I am learning PHP now and I am enjoying it. Im not an I.T. graduate that is why Im having very difficult time to understand codes. My problem is how to get the last character of a URL that I get using another php code. I can already post the URL on my page but it displays all the URL of the certain page that I get. Example: the URL is "http://mysite.com/page_1/pp1/?lang=zh" I only want to get the "?lang=zh". I am working under 3 languages and I want to get only that last part of the URL for me to continue my work. I dont exactly know what string or filtering I will do to get that part only. Please help me guys. I will appreciate all your comments here. I want to be able to keep people from entering certain characters in a form. I've tried google, and had no luck so far. Thanks! Hi What code would i use to take the first 2 letters of a post code so for example CM11 2AY I want the CM bit what command would strip the first 2 characters out? Thanks Hiya all, Final one from me for now! I'm trying to add a space into a string, which is 12 digits long, I need to add a space after character number 7, I've looked at the explode syntax but I'm struggling to find a way of counting 7 chars in and add a space, or split the string in two and then just output them with a space in between (which would be easier I think). Thanks, Jason Last question for the week now. Almost finished. All I need to do is: Remove characters from the beginning and the end of a string. Essentially: Code: [Select] a:4:{s:4:"full";s:111:"http://www.mothernatureinc.co.uk/wp-content/uploads/2011/02/166637_482678026567_509616567_6394964_6868412_n.jpg";i:96;s:117:"http://www.mothernatureinc.co.uk/wp-content/uploads/2011/02/166637_482678026567_509616567_6394964_6868412_n-96x96.jpg";i:60;s:117:"http://www.mothernatureinc.co.uk/wp-content/uploads/2011/02/166637_482678026567_509616567_6394964_6868412_n-60x60.jpg";i:32;s:117:"http://www.mothernatureinc.co.uk/wp-content/uploads/2011/02/166637_482678026567_509616567_6394964_6868412_n-32x32.jpg";} Needs to become Code: [Select] http://www.mothernatureinc.co.uk/wp-content/uploads/2011/02/166637_482678026567_509616567_6394964_6868412_n.jpg Any ideas? $name = "D'Angelo" ok I'm running a mysql query as $query = " INSERT INTO TEST (ID, NAME) VALUES ('NULL','$NAME')"; If the name = "D'Angelo" the apostrophe would cause it to fail. Is there a way to do this without striping the characters? Does anybody know of a function or a way of letting me get the string between whatever characters? Say I had [SOMEWORD] text [SOMEWORD] then how could I go about getting the value "text", please note I'm not trying to make bbcode or similar. Im not sure f this is the right spot for this or not but... I have a website that has a content box that has a fixed height and width. How would i make it so after the box is full it puts a link to read more at the bottom of it? Also images may be used as well. Its also for a wordpress blog Hey guys, I have a quick question. Im going to be making a script that will output the name of a news article along with the poster's name beside it. There is only a certain amount of space where that stuff can go so I want to know how I can make it so that say after 20 characters, it ends and puts "..." beside it. Is this possible with php? How would I do it? or need to extract all tags <p> from a site in Italian //////////////////////////////////////////////////////////////////////// header('Content-Type: text/html; charset=iso-8859-1'); function curl_file_get_contents($url) { $curl = curl_init(); $userAgent = 'Googlebot/2.1 (http://www.googlebot.com/bot.html)'; curl_setopt($curl,CURLOPT_URL,$url); //The URL to fetch. This can also be set when initializing a session with curl_init(). curl_setopt($curl,CURLOPT_RETURNTRANSFER,TRUE); //TRUE to return the transfer as a string of the return value of curl_exec() instead of outputting it out directly. curl_setopt($curl,CURLOPT_CONNECTTIMEOUT,10); //The number of seconds to wait while trying to connect. curl_setopt($curl, CURLOPT_USERAGENT, $userAgent); //The contents of the "User-Agent: " header to be used in a HTTP request. curl_setopt($curl, CURLOPT_FAILONERROR, TRUE); //To fail silently if the HTTP code returned is greater than or equal to 400. curl_setopt($curl, CURLOPT_FOLLOWLOCATION, TRUE); //To follow any "Location: " header that the server sends as part of the HTTP header. curl_setopt($curl, CURLOPT_AUTOREFERER, TRUE); //To automatically set the Referer: field in requests where it follows a Location: redirect. curl_setopt($curl, CURLOPT_TIMEOUT, 5); //The maximum number of seconds to allow cURL functions to execute. $contents = curl_exec($curl); curl_close($curl); return $contents; } $get = curl_file_get_contents($url); function getTextBetweenTags($tag, $html, $strict=0) { /*** a new dom object ***/ $dom = new domDocument; /*** load the html into the object ***/ if($strict==1) { $dom->loadXML($html); } else { $dom->loadHTML($html); } /*** discard white space ***/ $dom->preserveWhiteSpace = false; /*** the tag by its tag name ***/ $content = $dom->getElementsByTagname($tag); /*** the array to return ***/ $out = array(); foreach ($content as $item) { /*** add node value to the out array ***/ $out[] = $item->nodeValue; } /*** return the results ***/ return $out; } <?php $content = getTextBetweenTags1('p', $html); foreach( $content as $item ) { echo $item.'.'; } ?> ///////////////////////////////////////////////////////////////////////////////// My problem is that it does not recognize accented characters./// //////////////////////////////////////////////////////////////////////////////// "con un certo miglioramento del testo e, cosa più importante, con le firme dei sottoscrittori. scusate la ripetizione. che però, dicevano gli antichi, iuvat. un caro saluto. " Or need your help regards,cristian Hi
I'm trying to limit the number of characters in a postcode field in wordpress gravity form. This is what I have so far but its not working.
add_filter("gform_field_validation_24_47", "custom_validation"); function custom_validation($result, $value, $form, $field){ if(!$result["is_valid"] && $result["message"] == "Enter full address."){ $zip = $value["47.5"]; if(strlen($zip) > 10) { $result["is_valid"] = false; $result["message"] = "Max 10 characters"; } } return $result; }Can anyone tell me what the issue is? Thanks! Hi guys I am encoding JSON in PHP but want to know how to escape ' and " thats in the content? Thanks Hi, May I know how can I remove all characters after the first 3 characters after . e.g : 123.512645124 I want to maintain 123.512 without rounding up. Please advise and thanks. I wanted to use strstr and trim functions but I am not able to use it to get what I want.. can some guru please assist .. thanks again |