Page 1 of 1

mass content page creation

Posted: Thu Mar 16, 2006 11:17 am
by jd
hi,
i have the following request - I'm in the process of creating a site with lots of content. While using the standard procedure of creating pages, it takes a lot of time and a lot of clicking. Is there any way around it to save a bit of clicking?

Re: mass content page creation

Posted: Thu Mar 16, 2006 1:38 pm
by cyberman
Try the attached file ... you must rename it before.

[attachment deleted by admin]

Re: mass content page creation

Posted: Fri Mar 17, 2006 9:38 am
by jd
sincere thanks!

i'll try it now and i'll get back here later with feedback! :)

Re: mass content page creation

Posted: Fri Mar 17, 2006 10:33 am
by katon
Very interesting.  If you batch-create pages, how do you name them and what do you populate them with?

Re: mass content page creation

Posted: Fri Mar 17, 2006 10:45 am
by cyberman
The script is very simple and only for mass creation of pages. The page name is content and a ascending number. Every page will have the same content you define in script variable $content. Default is 100 pages.

Re: mass content page creation

Posted: Sat Dec 23, 2006 3:46 pm
by sieg23
I'm in a silmilar situation: hoping to be able to move pages from an array, or XML, then continue maintenance, adds and updates using the GUI.

If there is bare bones script around for doing that I'd totally appreciate having a look at it

Thanks ~S

Re: mass content page creation

Posted: Wed Dec 27, 2006 11:14 pm
by cyberman
Once again  :) ...

[gelöscht durch Administrator]

Re: mass content page creation

Posted: Tue Jan 09, 2007 12:09 pm
by fredt
I'm sorry, I just can't unzip this file (using latest 7zip). What format is this ? Can you please just post it as .txt ?

Thanks !

Re: mass content page creation

Posted: Tue Jan 09, 2007 12:40 pm
by cyberman
I know - last forum update destroys all attachments  >:(.

Here comes the source:

Code: Select all

<?php
require_once("include.php");


$content =" Please note that users of Microsoft Windows XP with Service Pack 2 will need to unblock this page in order to see the menu. The reason for this is due to the fact that the menu has been written in JavaScript. This feature is considered unsafe when used locally and Service Pack 2 now blocks this by default for your safety. This only happens when you run the menu on a local machine, live use on the Internet will not be affected.";

$end = 100;

$max_c=0;$max_h=0;$max_l=0;$max_s=0;$i=0;$parent=1;

global $gCms;
$db =&$gCms->db;

while ($i < $end)
{
  $ok =false;$tmp=0;
  $i++;
   echo 'Content - Number '.$i.' is running :';
    $max_c++;
    echo 'Content no: '.$max_c.'<br />';
    $type='content';$tmp=$max_c;
    $propname='content_en';
    $addcontent='Content Number'.$max_c.'<br />'.$content;


$owner=1;$templateid=1;$active=1;$cachable=1;$lasteditby=1;
$mname=$type.$tmp;$malias=$mname;$menutext=$mname;$order=$i+4;

$hierarchy='00001.'.str_repeat('0',5-strlen($order)).$order;

$newid = $db->GenID(cms_db_prefix()."content_seq");
$query = "INSERT INTO ".$config["db_prefix"]."content (content_id, content_name, content_alias, type, owner_id, parent_id, template_id, item_order, hierarchy, active, default_content, show_in_menu, cachable, menu_text, collapsed, markup, last_modified_by, create_date, modified_date) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
$dbresult = $db->Execute($query, array(
                        $newid,
			$mname,
			$malias,
			strtolower($type),
			$owner,
			1,
			1,
			$order,
			$hierarchy,
			1,
			0,
			1,
			1,
			$menutext,
                        0,
			'html',
			1,
			$db->DBTimeStamp(time()),
			$db->DBTimeStamp(time())
			));

$query = "INSERT INTO ".cms_db_prefix()."content_props (content_id, type, prop_name, param1, param2, param3, content) VALUES (?,?,?,?,?,?,?)";

$dbresult = $db->Execute($query, array($newid,'string',$propname,'','','',$addcontent,));



}

?>
Haven't tried yet if it works with current cmsms version ...

Re: mass content page creation

Posted: Tue Jan 09, 2007 5:27 pm
by fredt
Thanks for your answer.

I'll post here if it works... or will try to fix it !!!  ;)

Fred