Jump to content

How to string replace a variable name in a file with a session variable name ?


Recommended Posts

Hi All,

 

I'm using some of my own PHP coding in conjunction with a WYSIWYG website program (to save time) which uses inbuilt controls to allow me create a solution. Everything compiles fine and works, however I find I need to manually edit some of the compiled / created files with custom information / settings etc in order to make things work better (this is due to the rigid structure of some of the pre-built controls I am using in this program).

 

Anyway, I'm looking to create a PHP script that will go into the files that need manual editing and make the changes for me. I'm doing well so far, reading in the required file, and using the string replace command etc as a prototype, however I need to change a php variable string in one of my files to read as a session variable string. E.G I need the string "$Variable" in the file to actually say "$_SESSION['sessionvariable']" instead.

 

Can anyone help me with a piece of code that may be able to do this ?

If that $Variable thing was your actual problem then I would say

Rather than change the generated code, can you simply have something do

$Variable = $_SESSION['sessionvariable'];

before executing the file?

If that's not your actual problem, what is?

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.