Jump to content

explode, foreach, arg....


lordphate

Recommended Posts

Hey everyone, i'm having some issues here..

The following code is where i want to use the explode to enter new titles into the theme titles.

      $titles_explode = explode(" -: : | : : - ",file_get_contents("data/titles.inc.php"));
      foreach($titles_explode as $title) {
        $data = explode("___",$title);
        $titles_file = DOC_ROOT."/themes/".$theme."/titles.inc.php";
	include($titles_file);
	$title_str = "<?php ";
	$title_str .= go_through_array("\$titles",$titles);
	$title_str .= '$titles["'.$title[0].'"] = "'.$title[1].'";';
	$title_str .= '?>';
        $file_handler = fopen($titles_file,"w");
        fwrite($file_handler,$title_str);
        fclose($file_handler);

      }//foreach_titles

 

here is whats in data/titles.inc.php

 

files-: : | : : -|site_name|::Files___
files_upload-: : | : : -site_name|::Files Upload___
files_edit-: : | : : -site_name|::Files Edit___
files_manage-: : | : : -site_name|::Files Manage___
files_view-: : | : : -|site_name|::Files View

 

and heres' what its outputting [after the go_through_array function is where its messing up]

$titles["files-: : | : : -|site_name|::Files"] = "
files_upload-: : | : : -site_name|::Files Upload";
$titles["
"] = "
";
$titles["f"] = "i";

Link to comment
https://forums.phpfreaks.com/topic/146034-explode-foreach-arg/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

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