vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Writin $vars to a txt file (https://vborg.vbsupport.ru/showthread.php?t=43643)

stuuu 09-16-2002 10:32 PM

Writin $vars to a txt file
 
Code:

<?
$write_file = strtolower("../../links/$placement.txt");
$write_me = "\n<tr>\n\t<td bgcolor=\"$s_rot_one\" width=\"30%\" align=\"left\"><font face=\"tahoma, verdana, arial, helvetica\" size=\"2\"><a href=\"$url\" target=\"_blank\">$name</a></font></td>\n\t<td bgcolor=\"$s_rot_one\" width=\"70%\" align=\"left\"><font face=\"tahoma, verdana, arial, helvetica\" size=\"2\">$description</font></td>\n</tr>";
$old_txt = file($write_file);
$fp = fopen($write_file, "w");
fputs($fp, $write_me);
for($x=0;$x<count($old_txt);$x++) {
fputs($fp, trim($old_txt[$x])."\r\n");
}
fclose($fp);
?>

As you can see from the code above, I would like PHP NOT to evaluate SOME of the $vars ($s_rot_one) in my input line ($write_me).

This is what I want to see in my text file once the above code has been executed.

Code:

<tr>
<td bgcolor="$s_rot_one" width="30%" align="left"><font face="tahoma, verdana, arial, helvetica" size="2"><a href="url" target="_blank">name</a></font></td>
<td bgcolor="$s_rot_one" width="70%" align="left"><font face="tahoma, verdana, arial, helvetica" size="2">description</font></td>
</tr>

(plus the tabs!)

Any ideas PLEASE :)

futureal 09-17-2002 03:09 AM

You want to escape the "$" character so that PHP will not treat it as a variable name.

So this:

<td bgcolor=\"$s_rot_one\"

Should become this:

<td bgcolor=\"\$s_rot_one\"

It's basically the same as escaping the quotation marks. Hope this helps!


All times are GMT. The time now is 03:47 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01084 seconds
  • Memory Usage 1,710KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (2)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete