Guest Posted July 20, 2003 Share Posted July 20, 2003 Hi, This is my first mod, a simple News Box with DHTML/JavaScript powered scrolling content. The mod was adapted from Mattice's excellent Define Mainpage v1.2 mod. You can edit the contents of the news box through the admin section, the content file can display virtually any content and can accept PHP, HTML, DHTML/JavaScript, Flash & Images. You can see a working example here: http://www.dappamobiles.com/eshop/default.php Enjoy, Tq Quote Link to comment Share on other sites More sharing options...
Guest Posted July 20, 2003 Share Posted July 20, 2003 Oops :o Forgot to add the link: http://www.oscommerce.com/community/contributions,1370 Thanks, Tq :D Quote Link to comment Share on other sites More sharing options...
Farrukh Posted July 20, 2003 Share Posted July 20, 2003 Nice contribution :) Might give it a try Quote Link to comment Share on other sites More sharing options...
azer Posted July 21, 2003 Share Posted July 21, 2003 thanks ! Quote MS2 Link to comment Share on other sites More sharing options...
bill72 Posted July 21, 2003 Share Posted July 21, 2003 after installation, in the news admin i have: TEXT_FILE_DOES_NOT_EXIST why? :( Quote Link to comment Share on other sites More sharing options...
Guest Posted July 21, 2003 Share Posted July 21, 2003 Hi, Sorry about the error, I just realized the admin section has stopped working. Originally the mod relied on the mainnews.php file to be located in the /catalog/includes/languages/english/ directory however when I tried to display the contents of the file in the <iframe> tag OSC reported it could not access the includes/languages/english/ folder (permissions); its not a good idea to set the permissions on this folder so I moved the mainpage.php file to the root of OSC e.g. [YOURSERVER]/catalog/mainpage.php. The side affect of this is the admin section cannot find the file as its not in the languages folder - I have not deciphered the code fully yet in the define_mainnews.php file but looking at the code I realized the original mod is looking for the file in the includes/languages/english/ folder. The only quick rememdy is to copy the mainnews.php file into the /catalog/includes/languages/english/ directory and then edit the define_mainnews.php in the /admin/ folder and use the php copy command. I will test and post the fix shortly, long term version v1.1 will be released tonight as I have worked out a more concrete solution to the problem. Thanks, Taz Quote Link to comment Share on other sites More sharing options...
arwin Posted July 21, 2003 Share Posted July 21, 2003 @ dappamobiles I have just installed your contrib, and whalt I have now is a box in my eg default.php with a picture inside it, and already copied the mainnews.php into my includes/language directory so that I can edit it in the admin section. What I really don't understand is how to edit the define_mainnews.php ?? What do I have to do ? I don't know so much about php so that the copy command does not say too much to me... Could you give some exactly instructions ? THX in advance Arwin Quote ---------------------------------- Arwin Dustdar Cologne, Germany [email protected] Link to comment Share on other sites More sharing options...
Tank27 Posted July 21, 2003 Share Posted July 21, 2003 When you use the mainnews.php in the language folder you get access forbidden why is that? Quote Link to comment Share on other sites More sharing options...
Guest Posted July 21, 2003 Share Posted July 21, 2003 Hi, As requested here is the info you need, this is a quick and dirty hack until I get NewsBox v1.2 completed. I assume you have followed the instructions I supplied in the zip file so all files should be in place; copy the file mainnews.php to the following locations: catalog/mainnews.php where catalog is the main root folder for your site catalog/includes/languages/english/mainnews.php Edit the file admin/define_mainnews.php: Replace the followng code: require('includes/application_top.php'); // This will cause it to look for 'mainnews.php' $HTTP_GET_VARS['filename'] = 'mainnews.php'; switch ($HTTP_GET_VARS['action']) { case 'save': if ( ($HTTP_GET_VARS['lngdir']) && ($HTTP_GET_VARS['filename']) ) { if ($HTTP_GET_VARS['filename'] == $language . '.php') { $file = DIR_FS_CATALOG_LANGUAGES . $HTTP_GET_VARS['filename']; } else { $file = DIR_FS_CATALOG_LANGUAGES . $HTTP_GET_VARS['lngdir'] . '/' . $HTTP_GET_VARS['filename']; } if (file_exists($file)) { if (file_exists('bak' . $file)) { @unlink('bak' . $file); } @rename($file, 'bak' . $file); $new_file = fopen($file, 'w'); $file_contents = stripslashes($HTTP_POST_VARS['file_contents']); fwrite($new_file, $file_contents, strlen($file_contents)); fclose($new_file); } tep_redirect(tep_href_link(FILENAME_DEFINE_MAINNEWS, 'lngdir=' . $HTTP_GET_VARS['lngdir'])); } break; } With this code: require('includes/application_top.php'); // setup our file copy variables $source_file = DIR_FS_CATALOG_LANGUAGES . $HTTP_GET_VARS['lngdir'] . '/' . $HTTP_GET_VARS['filename']; $dest_file = DIR_FS_CATALOG . $HTTP_GET_VARS['filename']; // This will cause it to look for 'mainnews.php' $HTTP_GET_VARS['filename'] = 'mainnews.php'; switch ($HTTP_GET_VARS['action']) { case 'save': if ( ($HTTP_GET_VARS['lngdir']) && ($HTTP_GET_VARS['filename']) ) { if ($HTTP_GET_VARS['filename'] == $language . '.php') { $file = DIR_FS_CATALOG_LANGUAGES . $HTTP_GET_VARS['filename']; copy($source_file, $dest_file); } else { $file = DIR_FS_CATALOG_LANGUAGES . $HTTP_GET_VARS['lngdir'] . '/' . $HTTP_GET_VARS['filename']; copy($source_file, $dest_file); } if (file_exists($file)) { if (file_exists('bak' . $file)) { @unlink('bak' . $file); } @rename($file, 'bak' . $file); $new_file = fopen($file, 'w'); $file_contents = stripslashes($HTTP_POST_VARS['file_contents']); fwrite($new_file, $file_contents, strlen($file_contents)); fclose($new_file); copy($source_file, $dest_file); } tep_redirect(tep_href_link(FILENAME_DEFINE_MAINNEWS, 'lngdir=' . $HTTP_GET_VARS['lngdir'])); } break; } Make sure your two mainindex.php files have write permissions (using ftp program or your hosting control panel chmod the files to 666, read/write) so the define_mainnews.php code can edit and copy the files as required. The mod is simple, I added the following lines at the top of the code: // setup our file copy variables $source_file = DIR_FS_CATALOG_LANGUAGES . $HTTP_GET_VARS['lngdir'] . '/' . $HTTP_GET_VARS['filename']; $dest_file = DIR_FS_CATALOG . $HTTP_GET_VARS['filename']; This code is part of the PHP copy function, the $source_file is used to set the source file and the $dest_file is the destination file. I used the OSC variable DIR_FS_CATALOG to tell PHP what the folder location is and I used the $HTTP_GET_VARS function to set the file sub folder and filename (these are setup in application_top.php. Then I added the following code: copy($source_file, $dest_file); This performs the copy function and copies the file to the root folder of your website so the News Box can load the file correctly. The way the code works is simple, you edit mainnews.php file located in the /includes/languages/english/ folder, when you hit save the code saves the file and then copies it to the root folder. Version 1.2 will have the new code so the copy function will not be required and you don't need two copies of mainnews.php. If you need any help don't hesitate to ask, Taz Quote Link to comment Share on other sites More sharing options...
Tank27 Posted July 21, 2003 Share Posted July 21, 2003 doesnt work Quote Link to comment Share on other sites More sharing options...
Guest Posted July 21, 2003 Share Posted July 21, 2003 Tank27, In reply to your question, I am not sure why this happens. Originally I was going to use the file as is so the mainnews.php would be in the includes/languages/english/ folder but for some reason the site/PHP doesn't like the way I was calling the external file in the <iframe> tag. I am nearing completion of v1.2 which is not a total solution but works on the basis that the file mainnews.php is located in the root folder. v1.3 will get around the permissions problem, I think I know why this is happening - I am sure that its to do with the way I am calling the file, I think I need to rebuild the box code so that it uses the require method to call up the file; I know this is one way of doing it but I am sure there are better ways. Thanks, Taz Quote Link to comment Share on other sites More sharing options...
Tank27 Posted July 21, 2003 Share Posted July 21, 2003 why did you release a contrib that does not work Quote Link to comment Share on other sites More sharing options...
Guest Posted July 21, 2003 Share Posted July 21, 2003 Tank, This release was tested on three other live OSC sites and it worked the first time I developed it. When you say it doesn't work can you explain what doesn't work? Thanks, Taz Quote Link to comment Share on other sites More sharing options...
Tank27 Posted July 21, 2003 Share Posted July 21, 2003 go to http://www.tank27.com/catalog you will see that you get FORBIDDEN in the news area. no matter what I do or what permissions I set it never changes Quote Link to comment Share on other sites More sharing options...
arwin Posted July 21, 2003 Share Posted July 21, 2003 Me too! I have the same problem_ www.senana.de/aa/catalog/ @dappamobiles you wrote Make sure your two mainindex.php files have write permissions (using ftp program or your hosting control panel chmod the files to 666, read/write) so the define_mainnews.php code can edit and copy the files as required. What are these mainindex.php files you mention? Quote ---------------------------------- Arwin Dustdar Cologne, Germany [email protected] Link to comment Share on other sites More sharing options...
Guest Posted July 21, 2003 Share Posted July 21, 2003 Ignore my blabbling - I was getting two different posts mixed up here. The zip file contains a file called mainnews.php, this needs to be copied to two locations: /catalog/mainnews.php & /catalog/includes/languages/[LANGUAGE]/mainnews.php - where [LANGUAGE] is your language directory (english, german etc). Follow the instructions in the install.txt so you should have the following new files: /catalog/mainnews.php /catalog/includes/boxes/newsbox.php /admin/define_newsbox.php CHMOD both the mainnews.php files so they are set to 666 (read/write) permission. If you have followed the above and you still get permission denied error then edit the file /catalog/includes/application_top.php and change the line: define('FILENAME_MAINNEWS', 'mainnews.php'); To: define('FILENAME_MAINNEWS', 'http://yourdomain/catalog/mainnews.php'); This should fix the problem. v1.12 has been uploaded with the new changes. Thanks for the feedback, Taz Quote Link to comment Share on other sites More sharing options...
arwin Posted July 22, 2003 Share Posted July 22, 2003 Sorry dappamobiles, but this for me still doesn't solve the problem... :( THX Arwin Quote ---------------------------------- Arwin Dustdar Cologne, Germany [email protected] Link to comment Share on other sites More sharing options...
bill72 Posted July 22, 2003 Share Posted July 22, 2003 i get this massage: "You can't request this. Sorry your DNS spokes wrong" :roll: Quote Link to comment Share on other sites More sharing options...
Tank27 Posted July 22, 2003 Share Posted July 22, 2003 File Not Found The requested URL was not found on this server. Please go to www.Tank27.com and contact the webmaster. it is there Quote Link to comment Share on other sites More sharing options...
arwin Posted July 22, 2003 Share Posted July 22, 2003 me too "Error" file not found both mainnews are set to chmod 666 ! THX for supporting Arwin Quote ---------------------------------- Arwin Dustdar Cologne, Germany [email protected] Link to comment Share on other sites More sharing options...
Guest Posted July 22, 2003 Share Posted July 22, 2003 Hi, Guys thanks for all the feedback so far, since the feedback I have been working on refining the mod and making it as simple as possible. With any coding of this kind there will always be bugs and thats the one great thing about this forum, contributers are taking feedback from users and fixing or updating their mods. I have resolved the problem you guys have been experiencing, it was an error in the distribution, the file newsbox.php is pointing to the wrong location for the file mainnews.php. To fix the problem open the file newsbox.php located in /catalog/includes/boxes/newsbox.php and change the following line: $info_box_contents[] = array('text' => '<iframe id="datamain" src=' . DIR_WS_LANGUAGES . $languages . '/' . FILENAME_MAINNEWS . ' width=130 height=150 marginwidth=0 marginheight=0 hspace=0 vspace=0 frameborder=1 scrolling=no></iframe>'); To this: $info_box_contents[] = array('text' => '<iframe id="datamain" src=' . DIR_WS_CATALOG . '/' . FILENAME_MAINNEWS . ' width=130 height=150 marginwidth=0 marginheight=0 hspace=0 vspace=0 frameborder=1 scrolling=no></iframe>'); This will tell OSC to look for the file mainnews.php in the root of the website (using the pointer DIR_WS_CATALOG to tell the site the file is in the root folder), the old code was telling OSC to look in the languages/english/ folder which does not work now as the file does not exist in this folder since v1.12 of the mod. Please download v1.13 which contains all of the bug fixes http://www.oscommerce.com/community/contributions,1370 Thank you for being patient, Taz :roll: Quote Link to comment Share on other sites More sharing options...
bill72 Posted July 22, 2003 Share Posted July 22, 2003 why did you post this contribution? it doesn't work for anyone... :x Quote Link to comment Share on other sites More sharing options...
Guest Posted July 22, 2003 Share Posted July 22, 2003 Hi, When I originally commissioned this script it worked on three other OSC live sites, 1 Windows 2000/IIS based and two Linux/Unix boxes. Like any contribution on OSC there will be bugs and these would not have been found it I had not recieved the feedback. If your going to be critical about the post then why don't you do us all a favour and post to every person on this forum who has posted a contribution and there have been bugs, I am sure this will satisfy your urge to post questions about why something doesn't work. I am more than willing to help anyone who is experiencing problems with the contribution because at the end of the day I want to do my little bit for OSC and hopefully offer an contribution that other people would be interested in. Thanks, T :? Quote Link to comment Share on other sites More sharing options...
Tank27 Posted July 22, 2003 Share Posted July 22, 2003 all that stff you told me to do did absoutly nothing Quote Link to comment Share on other sites More sharing options...
azer Posted July 22, 2003 Share Posted July 22, 2003 it s really childing to ask such as "alberto" questions ... he thinks that maybe every body have the same configuration and the same version of osc , and for him it s normal that all the developpers of contribution that share for free should also provide him for free a FULLY TESTED WORKING contribution so that when he has the desire to use it , it works flawless ... :twisted: :idea: best advice if you wanna have less bug , when u see a contribution and don't want to be a beta tester u wait 3 month and then u come back again , there is a lot of chance that it should work at the best level ... :roll: "dappamobiles" i m not using your contribution but i hope you keep on working on it and users will give you feed back ... My opinion :wink: Quote MS2 Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.