mysql - Read and Write to php file -
i looking method write values of variable php file.
ok let me explain example:
i have normal php website , want add wordpress blog it.
i use same theme of wordpress other site too, removing wordpress tags , replacing them other application’s tags. here div ids , class names remain same. share same css & js files wordpress.
i want control width of sidebars , other parameters wordpress theme control panel. process think should be…
get value 'sidebar_a' , inputs '150px' value 'main_body' , inputs '550px' value 'sidebar_b' , inputs '200px' value ‘site_name’ , input comes wordpress tag value ‘footer ‘and again value comes wordpress footer.
now need small script write these values in php file like:
$sidebar_a = '100' $main_body = '550' $sidebar_b = '200' $sitename = ‘xyz corporation’ $footer = ‘copyright xyz corporation'
or better create database tables in mysql , write it.
i want call file in application 2 using
please feel free suggest, if there better way.
important: every time these parameters changed in wordpress, these values must updated new values.
kindly help.
write data
$data = array( 'sidebar_a' => $sidebar_a, 'main_body' => $main_body, 'sidebar_b' => $sidebar_b, 'sitename' => $sitename, 'footer' => $footer ); $data = serialize($data); file_put_contents('file.txt', $data);
read data
$data = file_get_contents('file.txt'); $data = unserialize($data); extract($data);
see serialize
, extract
Comments
Post a Comment