mass content page creation

Talk about new features for CMSMS and modules.
Post Reply
jd

mass content page creation

Post 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?
cyberman

Re: mass content page creation

Post by cyberman »

Try the attached file ... you must rename it before.

[attachment deleted by admin]
jd

Re: mass content page creation

Post by jd »

sincere thanks!

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

Re: mass content page creation

Post by katon »

Very interesting.  If you batch-create pages, how do you name them and what do you populate them with?
cyberman

Re: mass content page creation

Post 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.
sieg23

Re: mass content page creation

Post 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
cyberman

Re: mass content page creation

Post by cyberman »

Once again  :) ...

[gelöscht durch Administrator]
User avatar
fredt
Forum Members
Forum Members
Posts: 144
Joined: Mon Jun 27, 2005 10:36 am

Re: mass content page creation

Post 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 !
cyberman

Re: mass content page creation

Post 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 ...
User avatar
fredt
Forum Members
Forum Members
Posts: 144
Joined: Mon Jun 27, 2005 10:36 am

Re: mass content page creation

Post by fredt »

Thanks for your answer.

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

Fred
Post Reply

Return to “Feature ideas”