Jump to content

hansford

Members
  • Posts

    562
  • Joined

  • Last visited

  • Days Won

    4

Everything posted by hansford

  1. When using regular expressions to solve a problem, now you have two problems. It gets tricky because you need to know some basic pattern you can reliably count on so your expressions will work! If you know every time that you need to remove whatever is in parenthesis and the parenthesis, then this will work. Others might have a different approach. Test and retest whatever method you choose to see what works best for the given problem. $downloadedmetar1wind = 'S (2345678 degrees, whatever) at 26 MPH (3 5 7 9 11 FT,MPG,NBA) and 140/80 BP (Blood Pressure)'; $newWord = preg_replace('/(\s+\([^\)]*\))+/','',$downloadedmetar1wind);
  2. This is just another way of accomplishing the same task.. $downloadedmetar1wind = 'S (180 degrees) at 26 MPH (23 KT)'; $downloadedmetar1wind = preg_replace('/\s\(180 degrees\)/','',$downloadedmetar1wind); $downloadedmetar1wind = preg_replace('/\s\(23 KT\)/','', $downloadedmetar1wind);
  3. I just tested this code in a browser and it does what "I think you're wanting". <div style="float:left;margin:0px;"> <img src="1.jpg"> </div> <div style="margin:0px; float: right;"> <img src="2.jpg"> </div> <div style="clear:both;"></div> <div style="float:left;margin:0px;"> <img src="3.jpg"> </div> <div style="margin:0px; float: right;"> <img src="4.jpg"> </div>
  4. This is really a css question, not a php one, so the moderators will likely move it to the appropriate forum. Try setting the z-index of the main menu higher than the navigation menu. here is the nav menu: #cssmenu ul { position: relative; z-index: 597; float: left; } Set the same on the main menu, but make the number like 999;
  5. The moderators will move this question to the appropriate forum because it's not a php coding question. Can't tell what the rest of your layout looks like, but...you can add to the top image div: display:block; That will make the image hog the entire line and force the second div to fall beneath it. The second div will need to be floated left if you want it just underneath the image 1. Another way to do it is to put a dummy div in between the two image divs and clear the floats: <div id="clear-fix"></div> #clear-fix { clear:both; }
  6. Normally you would do this is the .htaccess file, but to do it in php you need to put some command to exit or stop execution if the index page is requested. If using a framework you'll need to specify the pages forbidden. If not, then a simple line at the top of the index page. exit('Unfortunately you don\'t have access to this page.');
  7. Unfortunately, I already have a job that keeps me busy. However, there are many hungry freelancers out there who will take on small projects like you have. They will bid and compete against one another. Not always wise to choose the cheapest bid, but look at their reputation and their experience to make your decision. https://www.freelancer.com/
  8. You can add another column to each row for size or you can display the product and size in one column. Either way, you'll have to use some logic to check if the product has a size. You can't have one row with such and such columns and another row with something different though - there needs to be consistency when you're pulling this data from the database. You can put in IF statements to determine if that product has a size that's not NULL or some other value and then display it if it does or display something like "N/A" if it doesn't. You might be asking the developer to do something that is impossible like only adding a column to certain rows, but not others.
  9. I should note that the previous code could mess you up IF the url protocol is already 'https' because the preg_replace function will still match the 'http' part and replace that part with https, so you'll end up with httpss - which is not what you want. A more robust solution would be this: echo preg_replace('/^http[^s]/i','https', $adventureList['thumbnailHiResURL']); This regular expression ('/^http[^s]/'i) means - match anything in the beginning of the string that's exactly 'http' followed by something that is not an 's' and ignore case. If you are satisfied that your question has been answered to your satisfaction, please mark this post as answered.
  10. You could try this...for example: $adventureList = array('thumbnailHiResURL'=>'http://cache.graphic...m/etcetcetc.jpg '); echo preg_replace('/^http/','https', $adventureList['thumbnailHiResURL']);
  11. You don't give us much to work with. Try the reset() function if you're just trying to reset the form. document.getElementById('your_form_id').reset();
  12. You wouldn't need to loop through them if I'm understanding you correctly - and probably not. You can select the required fields in the answers[] array too: $('input.required-fields')
  13. Try checking is the streams array is empty to start with: then add an IF statement to see if the ID exists. But if the new API is working for you - great.
  14. Find out what values are set if the channel is "not live". According to the manual: empty() "A variable is considered empty if it does not exist or if its value equals FALSE."
  15. Listen to the admin, I reread my comment and it is completely ridiculous. Long night, my apologies.
  16. Your script is going to have to write to the index.php file. Easy way is to make a template file with a searchable tag you can do a find and replace on like: {{replace_text}} You open the file, search and replace the tags you want. Will need to set the permissions on that file to make it writeable. Then use functions like: fopen() preg_match() or str_replace() fclose()
  17. Try this: $inputs = $('.required-fields'); Then add a generic class to the required fields. <label for="quest"> <input type="text" name="quest" class="required-fields" /> <!-- REQUIRED --> </label> <label for="answers"> <input type="text" name="answers[]" class="required-fields" /> <!-- REQUIRED --> </label> <label for="answers"> <input type="text" name="answers[]" class="required-fields" /> <!-- REQUIRED --> </label>
  18. You are calling a function "comments_number" - that function is getting the data from somewhere - usually a database. Check what that function returns without jQuery or anything else involved. You whittle the problem down piece by piece.
  19. Lol - I wrote the code and was going to post it, but the Guru's outrank me and they are right. They gave you all of the functions you need to make this happen. Good luck - it will be rewarding.
  20. If you actually wrote this code - how did you get so far with so many errors. You just wrote the whole thing without testing as you went along? That makes for a debugging nightmare. You need to bit by bit test as you code. So, you already wrote it, so all you need to do now is break it down into testable chunks. When all of the chunks give you the output you want - put it back together. use echo, var_dump, print_r so you can see what is going on.
  21. To just bring up the default mail program on the computer you can use the MAILTO option: form action="MAILTO:person@xxx.com" or you would have to implement something using PHPMailer or another mail program if you wanted the server to send the message.
  22. Try this: echo "<label for='$field'>$label</label> <select name='State'>"; foreach($states_list as $state) { echo "<option value={$state}>{$state}</option>"; } echo " </select> ";
  23. Not quite sure what you are trying to do. You can't render html elements in form elements. You can do some crafty CSS tricks to make it appear that way, but can't do it. You can try this as an approach and see if it suits your needs. <!DOCTYPE html> <html> <meta charset="UTF-8"> <head> <title>Example</title> <script type="text/javascript"> //JavaScript code goes here function insertAtEnd(text) { var theArea = document.getElementById("thisArea"); theArea.innerHTML = text; } </script> </head> <body> <input type="button" id="aleph" name="aleph" value="Write an aleph" onClick="javascript:insertAtEnd('<span>א</span>');return(false);" /> <div id="thisArea" style="margin-top:20px;width:50px;padding:2px;outline:1px solid #000000;" contenteditable="true"></div> </body> </html>
  24. <!DOCTYPE html> <html> <meta charset="UTF-8"> <head> <title>Example</title> <script type="text/javascript"> //JavaScript code goes here function insertAtEnd(text) { var theArea = document.getElementById("thisArea"); theArea.value += '' + text + ''; } </script> </head> <body> <input type="button" id="aleph" name="aleph" value="Write an aleph" onClick="javascript:insertAtEnd('\'<span>א</span>\'');return(false);" /> <textarea id="thisArea"> </textarea> </body> </html>
  25. I agree. Find another host. But I also agree, in the meantime, your host can restore whatever standard files they set up on new sites.
×
×
  • 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.