11
DobePhat
Re: How to clone News 1.44 module?
  • 2007/4/25 15:41

  • DobePhat

  • Friend of XOOPS

  • Posts: 656

  • Since: 2003/4/15


"News can't accept different templates for different categories"

-Ahhhh
Hey thats interesting, idea.
If we were able to assign a .class or #ID to topics or something we would be able to control their look in style sheet.

For instance if you create a new category-
A new id or class gets associated with it.

-.cat1, .cat2
etc.

Then, if you want to change their look...
hmmmmmm...

maybe?

12
nachenko
Re: How to clone News 1.44 module?
  • 2007/4/25 16:59

  • nachenko

  • Quite a regular

  • Posts: 356

  • Since: 2005/1/18


This would be interesting, but nothing like uploading a new template and selecting it, just like SmartSection or WF-Section.

This is very important for what you can make parts of the site look like an entirely different section while managing all content with just one menu. I don't mind using several modules, but non-experienced users should find it "too big burrito". News is very simple, so I want to stick with it.

(I only miss ability to assign weights to sections)

13
jfmoore
Re: How to clone News 1.44 module?
  • 2007/5/17 13:52

  • jfmoore

  • Quite a regular

  • Posts: 360

  • Since: 2004/6/6 5


All I can say is "Lots of luck" on this one. News 1.0 was easy to clone, but 1.44 is not.
...

14
nachenko
Re: How to clone News 1.44 module?
  • 2007/5/17 14:39

  • nachenko

  • Quite a regular

  • Posts: 356

  • Since: 2005/1/18


Thanks, but at the end i did not need to clone the module.

Anyway, I've been proposed for a big fat project and did some research. I just installed Drupal and Xaraya and started playing around. The New York Observer site moved to Drupal, and they wrote an article about it:

http://drupal.org/node/141187

I found it pretty interesting. I'll also print Xaraya guide and read it. Too much time working with XOOPS, a fresh viewpoint on CMS can not hurt me. Sun Tzu has said: "If you know the enemy and know yourself you need not fear the results of a hundred battles."

(yes, I read "the art of war").

15
mjoel
Re: How to clone News 1.44 module?
  • 2007/5/17 15:08

  • mjoel

  • Quite a regular

  • Posts: 325

  • Since: 2006/12/9


Here is a way to clone the news 1.44 module

1. upload the news 1.44 modules to your modules directory

2. Save the code below as clone.php and upload it into your XOOPS root...in this example it will clone the news module to a new module that i named as blog...




/*

Usage:
    
    Copy clone.php in 
    Change current working directory to 
    Update mappings as per new modulename.

    php -q clone.php 

*/

// ##########################################################
//    Define your mapping here
// ##########################################################
$patterns = array(
  
// first one must be module directory name
  
'news'  => 'blog'
  
'NEWS'  => 'BLOG',
  
'stories'  => 'blogs',
  
'stories_files' => 'blogs_files',
  
'topics' => 'topicblogs',
  
'article' =>'blogitem',
  
'storyid' => 'blogid',
  
'stories_votedata'  => 'blog_votedata'
  
'getmoduleoption' => 'getmoduleoption2',
'_MI_STORYHOME' => '_MI_STORYHOME2',
'_MI_NOTIFYSUBMIT' => '_MI_NOTIFYSUBMIT12',
'_MI_DISPLAYNAV' => '_MI_DISPLAYNAV12',
'_MI_AUTOAPPROVE' => '_MI_AUTOAPPROVE2',
'_MI_ALLOWEDSUBMITGROUPS' => '_MI_ALLOWEDSUBMITGROUPS2',
'_MI_ALLOWEDAPPROVEGROUPS' => '_MI_ALLOWEDAPPROVEGROUPS2',
'_MI_NAMEDISPLAY' => '_MI_NAMEDISPLAY2',
'_MI_COLUMNMODE' => '_MI_COLUMNMODE2',
'_MI_STORYCOUNTADMIN' => '_MI_STORYCOUNTADMIN2',
'_MI_UPLOADFILESIZE' => '_MI_UPLOADFILESIZE2',
'_MI_UPLOADGROUPS' => '_MI_UPLOADGROUPS2',
'_MI_STORYHOMEDSC' => '_MI_STORYHOMEDSC2',
'_MI_NOTIFYSUBMITDSC' => '_MI_NOTIFYSUBMITDSC2',
'_MI_DISPLAYNAVDSC' => '_MI_DISPLAYNAVDSC2',
'_MI_AUTOAPPROVEDSC' => '_MI_AUTOAPPROVEDSC2',
'_MI_ALLOWEDSUBMITGROUPSDESC' => '_MI_ALLOWEDSUBMITGROUPSDESC12',
'_MI_ALLOWEDAPPROVEGROUPSDESC' => '_MI_ALLOWEDAPPROVEGROUPSDESC2',
'_MI_ADISPLAYNAMEDSC' => '_MI_ADISPLAYNAMEDSC2',
'_MI_COLUMNMODE_DESC' => '_MI_COLUMNMODE_DESC2',
'_MI_STORYCOUNTADMIN_DESC' => '_MI_STORYCOUNTADMIN_DESC2',
'_MI_UPLOADFILESIZE_DESC' => '_MI_UPLOADFILESIZE_DESC2',
'_MI_UPLOADGROUPS_DESC' => '_MI_UPLOADGROUPS_DESC2',
'_MI_DISPLAYNAME1' => '_MI_DISPLAYNAME12',
'_MI_DISPLAYNAME2' => '_MI_DISPLAYNAME22',
'_MI_DISPLAYNAME3' => '_MI_DISPLAYNAME32' ,
'_MI_UPLOAD_GROUP1' => '_MI_UPLOAD_GROUP12',
'_MI_UPLOAD_GROUP2' => '_MI_UPLOAD_GROUP22',
'_MI_UPLOAD_GROUP3' => '_MI_UPLOAD_GROUP32',
'_MI_NEWS_GLOBAL_NOTIFY' => '_MI_NEWS_GLOBAL_NOTIFY2',
'_MI_NEWS_GLOBAL_NOTIFYDSC' => '_MI_NEWS_GLOBAL_NOTIFYDSC2',
'_MI_RESTRICTINDEX' => 'MI_RESTRICTINDEX2',
'_MI_RESTRICTINDEXDSC' => '_MI_RESTRICTINDEXDSC2',
'MygetItemIds' => 'MygetItemIds2',
'CreateSiteNavBar' => 'CreateSiteNavBar2',
'_MB_POSTER' => '_MB_POSTER2',
'updateCache' => 'updateCache2',
'TableExists' => 'TableExists2',
 
'AddField' => 'AddField2',
'FieldExistsAddField' => 'FieldExistsAddField2',
'is_admin_group' => 'is_admin_group2',
'make_infotips' => 'make_infotips2',
'FieldExists' => 'FieldExists2'
);

$patKeys array_keys($patterns);
$patValues array_values($patterns);

// work around for PHP < 5.0.x
if(!function_exists('file_put_contents')) {
  function 
file_put_contents($filename$data$file_append false) {
    
$fp fopen($filename, (!$file_append 'w+' 'a+'));
    if(!
$fp) {
      
trigger_error('file_put_contents cannot write in file.'E_USER_ERROR);
      return;
    }
    
fputs($fp$data);
    
fclose($fp);
  }
}

// recursive clonning script
function cloneFileFolder($path
{
  global 
$patKeys;
  global 
$patValues;
  
  
$newPath str_replace($patKeys[0], $patValues[0], $path);

  if (
is_dir($path)) 
  {
    
// create new dir
    
mkdir($newPath);
    
    
// check all files in dir, and process it
    
if ($handle opendir($path))
    {
      while (
$file readdir($handle)) 
      {
        if (
$file != '.' && $file != '..'
        {
          
cloneFileFolder("$path/$file");
        }
      }
      
closedir($handle);  
    }
  } 
  else 
  {
    if(
preg_match('/(.jpg|.gif|.png|.zip)$/i'$path)) 
    {
      
copy($path$newPath);
    } 
    else 
    {
      
// file, read it
      
$content file_get_contents($path);
      
$content str_replace($patKeys$patValues$content);
      
file_put_contents($newPath$content);
    }
  }
}

cloneFileFolder('modules/news');

echo 
"Happy cloning...n";
echo 
"check directory modules/" $patterns['smartsection'] . " for cloned module n";
echo 
"Consider modifying new module by editing language/english/modinfo.php and images/news_slogo.png manually (if you care)n";

?>


** the code above is originally from SmartFactory's smartsection modules zip file..i modify it a bit **


u can change the name of the clone module to anything...as long u follow the caps rule..example - if u want the name of the clone module to be mynews...find
'news'  => 'blog'
  
'NEWS'  => 'BLOG',
  
'stories'  => 'blogs',
  
'stories_files' => 'blogs_files',
  
'topics' => 'topicblogs',
  
'article' =>'blogitem',
  
'storyid' => 'blogid',
  
'stories_votedata'  => 'blog_votedata',

and replace it with these

'news'  => 'mynews'
  
'NEWS'  => 'MYNEWS',
  
'stories'  => 'mynewsstories',
  
'stories_files' => 'news_files',
  
'topics' => 'topicnews',
  
'article' =>'newsitem',
  
'storyid' => 'newsid',
  
'stories_votedata'  => 'news_votedata',


don't change other part of the code..


3. run the code .. XOOPS root/clone.php ...example
http://www.yoursite.com/clone.php

3. Install the new cloned module, edit the language/english/modinfo.php and images/news_slogo.png

4. update clone module

5. enjoy..

so far i don't have any problem using the clone module and news 1.44 at the same time in my site


Ok Good luck

16
RoMeO
Re: How to clone News 1.44 module?
  • 2007/5/26 16:41

  • RoMeO

  • Just popping in

  • Posts: 34

  • Since: 2005/8/27


Thanks @mjoel

Can you copy news spotlight module ? ;)

17
mboyden
Re: How to clone News 1.44 module?
  • 2007/5/26 20:49

  • mboyden

  • Moderator

  • Posts: 484

  • Since: 2005/3/9 1


BTW, if anything, start with the latest version of this module which is 1.53 currently.
Pessimists see difficulty in opportunity; Optimists see opportunity in difficulty. --W Churchill

XOOPS: Latest | Debug | Hosting and Web Development

18
andycleff
Re: How to clone News 1.44 module?
  • 2007/8/21 15:04

  • andycleff

  • Not too shy to talk

  • Posts: 108

  • Since: 2005/4/29


Got close following the above instructions with News v 1.53.

When I loaded the XOOPS Module Admin Screen (to install my clone) I got the following:
====
Fatal error: Cannot redeclare dublinquotes() (previously declared in /var/www/html/modules/news/include/functions.php:258) in /var/www/html/modules/casestudy/include/functions.php on line 258
====
Line 258 reads: function DublinQuotes($text) {

Anybody have a solution?
Andy Cleff
Ampersand Design, Inc
Doylestown, PA
-----
Helping our clients bring great ideas into shape through integrated marketing, creative branding, print and web strategy, online learning and e-commerce.

http://www.ampersandesign.net

19
andycleff
Re: How to clone News 1.44 module?
  • 2007/8/21 16:17

  • andycleff

  • Not too shy to talk

  • Posts: 108

  • Since: 2005/4/29


Figured out a fix:

Simply renamed all 7 or so occurances of DublinQuotes to DublinQuotes2 in my clones functions.php
Andy Cleff
Ampersand Design, Inc
Doylestown, PA
-----
Helping our clients bring great ideas into shape through integrated marketing, creative branding, print and web strategy, online learning and e-commerce.

http://www.ampersandesign.net

20
sadistiko
Re: How to clone News 1.44 module?
  • 2007/8/25 20:07

  • sadistiko

  • Friend of XOOPS

  • Posts: 477

  • Since: 2004/12/13


Quote:
Simply renamed all 7 or so occurances of DublinQuotes to DublinQuotes2 in my clones functions.php


I do that, and it seams everithing works well, but when you want add some article it doesn't work
When I click submit button all I get is blank screen, and no new added text in list of articles.
Croatian Xoops support site:
http://www.xoopshr.org
Lowcost linux hosting:
http://www.adpgroup.hr

Login

Who's Online

288 user(s) are online (200 user(s) are browsing Support Forums)


Members: 0


Guests: 288


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits