minic studio Posted October 6, 2010 Share Posted October 6, 2010 Hi!I`m wondering is that possible to write a module to the back office which can write into files (.txt files).My front office banner links and pictures path are stored in a .txt file so if i want to modify them i need too use ftp , and i thinking is that possible to write a simple module that can handle whit this problem under back office?If someone has tips ot something pls help me. Link to comment Share on other sites More sharing options...
yodapt Posted October 8, 2010 Share Posted October 8, 2010 Seems perfectly possible Link to comment Share on other sites More sharing options...
minic studio Posted October 8, 2010 Author Share Posted October 8, 2010 Seems thats the problem for me.I searched for some php scripts that can handle whit this file editing stuff, the script for its own working fine .After the search i modified a simple module and tried to add that script but no success ... <?php include_once(PS_ADMIN_DIR.'/../classes/AdminTab.php'); class AdminTutorial extends AdminTab { private $module = 'tutorial'; public function __construct() { global $cookie, $_LANGADM; $langFile = _PS_MODULE_DIR_.$this->module.'/'.Language::getIsoById(intval($cookie->id_lang)).'.php'; if(file_exists($langFile)) { require_once $langFile; foreach($_MODULE as $key=>$value) if(substr(strip_tags($key), 0, 5) == 'Admin') $_LANGADM[str_replace('_', '', strip_tags($key))] = $value; } parent::__construct(); } public function display() { } } ?> php script $akarmi = "test.txt"; if (isset($_POST['content'])) { $content = stripslashes($_POST['content']); $fp = fopen($akarmi,"w") or die ("Error opening file in write mode!"); fputs($fp,$content); fclose($fp) or die ("Error closing file!"); } <form action="<?php echo $_SERVER["PHP_SELF"] ?>" method="post"> <textarea rows="10" cols="40" name="content" ><?php readfile($akarmi); ?></textarea> <input type="submit" value="Save"> </form> Link to comment Share on other sites More sharing options...
yodapt Posted October 8, 2010 Share Posted October 8, 2010 prestashop isn't user friendly, neither for clients or developers, so the best way to put it to work is by doing some reverse engineering. I'd suggest to use an editor like tinymce to edit the txt file. Link to comment Share on other sites More sharing options...
minic studio Posted October 8, 2010 Author Share Posted October 8, 2010 Ok, but how can i use tinymce for this? I can integrate that somehow? Link to comment Share on other sites More sharing options...
yodapt Posted October 8, 2010 Share Posted October 8, 2010 modules have html views, just include them .. otherwise, use a textarea or a group of inputs. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now