Jump to content

Allen4172

Members
  • Posts

    17
  • Joined

  • Last visited

    Never

Everything posted by Allen4172

  1. Your right.  In this case I ONLY want to get that $text$ variable out. Problem lies in that statement: [code] <?php $text = '$text$'; ?> [/code] If anywhere in $text$ it has a ' then it will break that echo statement and give an error.  So thus I'm searching for a way to somehow auto add a backslah in that string to avoid getting parse errors.
  2. Its a closed source CMS that is being entered via fields similar to forms.  So I have no control over what they enter and can not modify the existing program since its closed source (my script deals with the inputs after the program is done with it).  I've researched google and the php manual for answers for a couple weeks and couldn't find anything meaningful that would help.  I'm sure I'm not the first person with this problem, but just can't seem to find the answer. In the program, for example, I'm getting a field called $text$.  So right now I declar it via $text = '$text$' since there is a chance a single quote won't be in there.  However there will ALWAYS be a double quote in there from the WYSIWYG editor in the CMS.
  3. That's the problem though.  I'm looking to try and find away to automize the text not to give an error and auto add a backslash. An example real world text would be this: <p style="margin:0cm 0cm 0pt">by completing a registration form and returning it on Friday you'll be able to avoid late fees. As you can see the real world text has BOTH " and ' in it.  Trying to explain to people who have used the web very little in the past, that you must always use a backslash before a single quote is the equiv to banging your head against a wall.
  4. [quote] You can also create a function- [code] <?php safe_echo($text){ //$text is the text to be printed echo(str_replace("'", "\'", $text)); } ?> [/code] [/quote] That seems like the most promising so far.  But if I declare $text = 'Single quote's suck'; above, it'll give the error.  How would I go about declaring $text without breaking the code?
  5. [code] <?php echo addslashes('Text hate's single quotes'); ?> [/code] Gives an T_LNUMBER errror when I attempt that.
  6. I can't use double quotes since there are more double quotes than single quotes.  For example this wouldn't work: [code] <?php echo htmlentities('Text won't always be nice'); ?> [/code] It gives an error of unexpected T_STRING.
  7. I have something like the following: [code] echo 'Text wont' always be nice'; [/code] What's the best way to automatically (not manually putting a slash) ensure that the single quote in the echo statement won't break it?
  8. [url=http://wycombeabbey.eu/request/request.php]http://wycombeabbey.eu/request/request.php[/url] I'm setting the max height in the TD's and have no problems in FF, netscape ect...but good ol IE gives problems.  Is there something I'm overlooking?
  9. [!--quoteo(post=387337:date=Jun 23 2006, 09:13 PM:name=betoranaldi)--][div class=\'quotetop\']QUOTE(betoranaldi @ Jun 23 2006, 09:13 PM) [snapback]387337[/snapback][/div][div class=\'quotemain\'][!--quotec--] I will look into PEAR and I have some PHPMailer experiance, can these be used with a cron job? [/quote] Not sure how familar you are with running CronJobs but they they basically just execute a page ever XX minutes you set. Cronjobs run whatever you tell it to run, so you can execute any links/scripts with it.
  10. a-base, Change [code] print ("\n<div class=\"itemtitle\"><a target="_blank" href=\"" . $rss_channel["ITEMS"][$i]["LINK"] . "\">" . $rss_channel["ITEMS"][$i]["TITLE"] . "</a></div>" [/code] To this: [code] print ("\n<div class=\"itemtitle\"><a target=\"_blank\" href=\"" . $rss_channel["ITEMS"][$i]["LINK"] . "\">" . $rss_channel["ITEMS"][$i]["TITLE"] . "</a></div>" [/code] That should take care of the parser error.
  11. I'm writing an a script where a user can click a link, and it'll bring up an email type prompt where they can email an article link of the story to a friend and so forth. I see it all the time on other sites, but am curious how I would get the <title> or subject of that article dynamically? Any ideas or recomendations would be much appreciated :)
  12. I'm new to JS and not really sure where to start with this. Basically I'm trying to enbed an ad inside article content without manually having to do it. My goal is to get something similar to how www.sportsline.com does theirs. My idea would be to have something like this: [code] <script> ---some code here--- </script> Some article content [/code] The script would then go to the end of the first paragraph and then insert the ad. Any ideas or suggestions?
  13. Take a look at the fopen and fwrite commands. That should get you started in the right direction.
  14. [!--quoteo(post=377681:date=May 27 2006, 07:34 PM:name=jcoones)--][div class=\'quotetop\']QUOTE(jcoones @ May 27 2006, 07:34 PM) [snapback]377681[/snapback][/div][div class=\'quotemain\'][!--quotec--] Please ignore this post. I figured it out! [/quote] Did you figure out how to do it in PHP? If so would you please post the solution so others may see.
  15. I've tried a couple of things and can't seem to get it to work properly. I'm attempting to check if a value is NULL. I've tried things like: [code] if($variable$ == NULL) {    $php_var = 0;} [/code] The variable isn't from PHP, its from a CMS system, that uses its variables as $something$. With this system, if nothing is typed in, its just blank spaces and the php would see: [code] if(     == NULL){    $php_var = 0;} [/code] I'm trying to make it to where, if nothing was entered in, and the script sees the blank, then it would auto put it as 0. Any help or ideas would be appreciated. :)
  16. You'd want something like this: [code] <form action="form.php" method="post"> <p><input type="text" name="host" /> <p><input type="text" name="user" /> <p><input type="text" name="password" /> <p><input type="submit" value="hit it!" /> </form> <?php $host = $_POST['host']; $user = $_POST['user']; $password = $_POST['password']; ?> [/code]
×
×
  • 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.