11
Djiman
Re: News 1.44 duplicatable?
  • 2006/8/11 14:27

  • Djiman

  • Just popping in

  • Posts: 91

  • Since: 2006/7/26


After you have installed your new module(MYNEWS)

Open your modules/system/blocks/system_blocks.php
(system_blocks.php)
on line: 180
or right above this line:"
// this block is deprecated" **** line 166 i think***
you paste these lines


// this block is deprecated
//for mynews 2006
function b_system_waiting_show()
{
global $xoopsUser;
$xoopsDB =& Database::getInstance();
$module_handler =& xoops_gethandler('module');
$block = array();
if ($module_handler->getCount(new Criteria('dirname', 'mynews'))) {
$result = $xoopsDB->query("SELECT COUNT(*) FROM ".$xoopsDB->prefix("mystories")." WHERE published=0");
if ( $result ) {
$block['modules'][0]['adminlink'] = XOOPS_URL."/modules/mynews/admin/index.php?op=newarticle";
list($block['modules'][0]['pendingnum']) = $xoopsDB->fetchRow($result);
$block['modules'][0]['lang_linkname'] = _MB_SYSTEM_MY_SUBMS;
}
}


Next step: -language.

In the system folder
-modules/system/languages/blocks.php

you add this line ///start/// define("_MB_SYSTEM_MY_SUBMS","Submitted MYNews");
// end// somewhere, or below line #15. without the comments !

why all that? Just for you to have the pending news in your waitng block.

12
Djiman
Re: News 1.44 duplicatable?
  • 2006/8/11 14:29

  • Djiman

  • Just popping in

  • Posts: 91

  • Since: 2006/7/26


sorry double posting deleted

13
acegamer
Re: News 1.44 duplicatable?
  • 2006/8/11 16:38

  • acegamer

  • Not too shy to talk

  • Posts: 162

  • Since: 2005/7/11


thx a lot !

Now i just need, just one more news 1.44 clone...
so that i have 3 news 1.44 modules...

Someone, have another one ?

14
Djiman
Re: News 1.44 duplicatable?
  • 2006/8/11 17:48

  • Djiman

  • Just popping in

  • Posts: 91

  • Since: 2006/7/26


man! what are you doing with these things in such quantity?
are going to compete with cnn?

15
acegamer
Re: News 1.44 duplicatable?
  • 2006/8/11 17:54

  • acegamer

  • Not too shy to talk

  • Posts: 162

  • Since: 2005/7/11


It's for a new project...

3 sites in one...

news, enterainment, and nsfw stuff
Bud i need one more news module 1.44 to finish.

Because i can't get the users tabels not shared over 2 subdomains and one main site, so we gonna take a other route... -> with 3 news 1.44 modules

Why 3? So that the thema's can be changed, (afhankelijk van) on with module visitors are... So that i looks like they are on a differend site, it's hard to explain it in english

16
Djiman
Re: News 1.44 duplicatable?
  • 2006/8/11 17:58

  • Djiman

  • Just popping in

  • Posts: 91

  • Since: 2006/7/26


did you check you messagebox?

17
acegamer
Re: News 1.44 duplicatable?
  • 2006/8/12 16:41

  • acegamer

  • Not too shy to talk

  • Posts: 162

  • Since: 2005/7/11


yes, thx
_________


But i have a problem now, when there are 2 or more news 1.44 modules installed, you can't view "My Profile"

php debugger say's this

Quote:
Fatal error: Cannot redeclare getmoduleoption() (previously declared in *********/www/modules/news/include/functions.php:41) in *********/www/modules/fun/include/functions.php on line 41



Someone know what i must do :o

cheers,
AceG.

-----------------------------
*** is for security reason's

Here you see the original module that is installed on line 41
Quote:
/**
* Returns a module's option
*
* Return's a module's option (for the news module)
*
* @package News
* @author Hervé Thouzard (http://www.herve-thouzard.com)
* @copyright (c) The XOOPS Project - http://www.xoops.org
* @param string $option module option's name
*/
function getmoduleoption($option, $repmodule='news')
{
global $xoopsModuleConfig, $xoopsModule;
static $tbloptions= Array();
if(is_array($tbloptions) && array_key_exists($option,$tbloptions)) {
return $tbloptions[$option];
}


And here of the clone module news 1.44 (ake fun 1.44)
Quote:
* @package News
* @author Hervé Thouzard (http://www.herve-thouzard.com)
* @copyright (c) The XOOPS Project - http://www.xoops.org
* @param string $option module option's name
*/
function getmoduleoption($option, $repmodule='fun')
{
global $xoopsModuleConfig, $xoopsModule;
static $tbloptions= Array();
if(is_array($tbloptions) && array_key_exists($option,$tbloptions)) {
return $tbloptions[$option];
}

$retval=false;
if (isset($xoopsModuleConfig) && (is_object($xoopsModule) && $xoopsModule->getVar('dirname') == $repmodule && $xoopsModule->getVar('isactive'))) {
if(isset($xoopsModuleConfig[$option])) {
$retval= $xoopsModuleConfig[$option];
}

18
kris_fr
Re: News 1.44 duplicatable?
  • 2006/8/12 16:49

  • kris_fr

  • Theme Designer

  • Posts: 1009

  • Since: 2005/12/31


For news clone, this php file (utilisation idem smartsection) :

/*
Usage:

    Copy clone_news.php in 
    Change current working directory to 
    Update mappings as per new modulename.

    php -q clone_news.php

*/

// ##########################################################
//    Define your mapping here
// ##########################################################
$patterns = array(
  
// first one must be module directory name
  
'news'  => 'memo',
  
'NEWS'  => 'memo',
  
'News' => 'Memo',
  
'stories' => 'memo_stories',
  
'topics' => 'memo_topics',
  
'getmoduleoption' => 'memogetmoduleoption',
  
'MygetItemIds' => 'memoMygetItemIds',
  
'CreateSiteNavBar' => 'memoCreateSiteNavBar',
  
'updateCache' => 'memoupdateCache',
  
'TableExists' => 'memoTableExists',
  
'FieldExists' => 'memoFieldExists',
  
'AddField' => 'memoAddField',
  
'is_admin_group' => 'memois_admin_group',
  
'make_infotips' => 'memomake_infotips',
);

$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['news'] . " for cloned module n";
echo 
"Consider modifying new module by editing language/english/modinfo.php and images/" $patterns['news'] . "_slogo.png manually (if you care)n";

?>


Thanks Dugris (French Team)

19
acegamer
Re: News 1.44 duplicatable?
  • 2006/8/12 22:58

  • acegamer

  • Not too shy to talk

  • Posts: 162

  • Since: 2005/7/11


Your script don't work for me :s
it work one time, but you can install the module, but it gives some weird errors all the time...

But, thx
_________

And already have 2 clones of news 1.44 but i only have a problem, when you go to your profile at the site...
It gives a white page!

The "edit your profile" & "notifvications" works fine!!

But i have a problem now, when there are 2 or more news 1.44 modules installed, you can't view "My Profile"

""php debugger say's this""

Quote:
Fatal error: Cannot redeclare getmoduleoption() (previously declared in *********/www/modules/news/include/functions.php:41) in *********/www/modules/fun/include/functions.php on line 41



Does someone know what i must do?! plz :o

Here you see the original module that is installed on line 41

Quote:
/**
* Returns a module's option
*
* Return's a module's option (for the news module)
*
* @package News
* @author Hervé Thouzard (http://www.herve-thouzard.com)
* @copyright (c) The XOOPS Project - http://www.xoops.org
* @param string $option module option's name
*/
function getmoduleoption($option, $repmodule='news')
{
global $xoopsModuleConfig, $xoopsModule;
static $tbloptions= Array();
if(is_array($tbloptions) && array_key_exists($option,$tbloptions)) {
return $tbloptions[$option];
}


And here of the clone module news 1.44 (ake fun 1.44)
Quote:
* @package Fun
* @author Hervé Thouzard (http://www.herve-thouzard.com)
* @copyright (c) The XOOPS Project - http://www.xoops.org
* @param string $option module option's name
*/
function getmoduleoption($option, $repmodule='fun')
{
global $xoopsModuleConfig, $xoopsModule;
static $tbloptions= Array();
if(is_array($tbloptions) && array_key_exists($option,$tbloptions)) {
return $tbloptions[$option];
}

$retval=false;
if (isset($xoopsModuleConfig) && (is_object($xoopsModule) && $xoopsModule->getVar('dirname') == $repmodule && $xoopsModule->getVar('isactive'))) {
if(isset($xoopsModuleConfig[$option])) {
$retval= $xoopsModuleConfig[$option];
}
[/quote]

20
acegamer
Re: News 1.44 duplicatable?
  • 2006/8/13 3:45

  • acegamer

  • Not too shy to talk

  • Posts: 162

  • Since: 2005/7/11


Someone?


Thx

Login

Who's Online

391 user(s) are online (313 user(s) are browsing Support Forums)


Members: 0


Guests: 391


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