Topic: CODE: How to Make MODx Pages from an HTML List  (Read 4038 times)

Pages: [1]   Go Down

#1: 14-Nov-2007, 02:37 PM


devtrench
Posts: 66

Just Kickin It

WWW
I wrote this code last night that will take an unordered list of page titles and insert pages into the database.  I used this code to add 650+ pages to a site from a list my client gave me in Microsoft Word.  I get these all the time so I thought it would be cool to go straight from a list to MODx pages.  Until this time I used the SuperPage Module, but this is faster.  This is the development forum so I'll just let you read the down and dirty code (attached), but feel free to ask questions. This would be really easy to turn into a module, so I might do that at some point. 

To use, run this script from your local or remote web server and point your favorite web browser at it.  Enter your list into the text area and click submit (your list probably needs to be xhtml valid in order for it to work right).  There are a few vars in the script that you can adjust, so take a peek there.

I'm interested to know what others think of this, and if anyone else has some cool helper scripts like this...

James

* page-inserter.zip (1.69 KB - downloaded 232 times.)
« Last Edit: 16-Nov-2007, 12:11 PM by devtrench »

#2: 14-Nov-2007, 03:04 PM

Testers

dev_cw
Posts: 4,179

WWW
This sounds cool, can be a real time saver. I will use it for setting up the structure for my next project. Thanks.

Sorry, I don't have any cool tools to share yet.
Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

Something is happening here, but you don't know what it is.
Do you, Mr. Jones?  -  [bob dylan]

#3: 14-Nov-2007, 03:19 PM


devtrench
Posts: 66

Just Kickin It

WWW
This sounds cool, can be a real time saver. I will use it for setting up the structure for my next project. Thanks.

Sorry, I don't have any cool tools to share yet.

Great, I hope it works for you.  Smiley

#4: 15-Nov-2007, 02:33 AM


chinesedream
Posts: 332

Lotus Seeds Design

WWW
Can you save a zip file? I can't open the 'gz'.

Thanks!

#5: 15-Nov-2007, 03:22 AM

Coding Team

sottwell
Posts: 10,530

WWW
http://www.7-zip.org/
sottwell.com has moved to a lovely Solaris 10 server!
Log in username guest, password guestuser.
Templates are now becoming available at http://sottwell.com/templates.html

#6: 15-Nov-2007, 03:34 AM


chinesedream
Posts: 332

Lotus Seeds Design

WWW

Thanks, but I think it's for PC only.  I am on Mac, have the default BOMArchiveHelper and Stuffit Expander Intel Mac version (this one kept crashing though). Actually Stuffit Expander can open 'gz', but I have encountered quite many gz files from Modx are other CMS, JS library sites are corrupted . I think the problem is not to do with my Expander but the file that was created or during the upload to server(s) got corrupted.

#7: 15-Nov-2007, 04:31 AM

Coding Team

sottwell
Posts: 10,530

WWW
Ah. I have an older (well, almost 2 years old) G4 iBook, and the latest update to Stuffit (12, I believe) works just fine. Earlier it was crashing rather frequently on archives from MODx. So I used this

http://leifh.up.md/apps/ez7z.html
sottwell.com has moved to a lovely Solaris 10 server!
Log in username guest, password guestuser.
Templates are now becoming available at http://sottwell.com/templates.html

#8: 15-Nov-2007, 12:07 PM


devtrench
Posts: 66

Just Kickin It

WWW
Can you save a zip file? I can't open the 'gz'.

Thanks!

Zip file added in case you are still having issues. If you're on OS X, can't you just use the command line though? 

Anyway, it's been added to the original post.

James

#9: 15-Nov-2007, 02:57 PM


chinesedream
Posts: 332

Lotus Seeds Design

WWW

Zip file added in case you are still having issues. If you're on OS X, can't you just use the command line though? 

Anyway, it's been added to the original post.

James

Many thanks! James.
I don't know how to use command line to to un-gz. Terminials isnt' a place I dare to wander : Grin Alwalys afraid to screw up my files (that I am quite capable of messing things up)

#10: 15-Nov-2007, 03:16 PM


chinesedream
Posts: 332

Lotus Seeds Design

WWW
Thanks for the link. I will try it now.

I installed the Expander about 10 months ago. Maybe it has a new version I didn't know, will check it out too.

#11: 16-Nov-2007, 09:57 AM


ChuckTrukk
Posts: 851

WWW
i use Unarchiver on osx. its small, free, and quick. And i havent found a filetype it doesnt open.
Chuck the Trukk
ProWebscape.com :: Nashville-WebDesign.com
- - - - - - - -
What are TV's? Here's some info below.
http://modxcms.com/forums/index.php/topic,21081.msg159009.html#msg1590091
http://modxcms.com/forums/index.php/topic,14957.msg97008.html#msg97008

#12: 16-Nov-2007, 11:23 AM

Coding Team

sirlancelot
Posts: 576

PHP, XML, XSL Supporter

WWW
Something might be wrong with the gzipped file, I can't unzip it either.... "Unexpected end of file"

#13: 16-Nov-2007, 12:13 PM


devtrench
Posts: 66

Just Kickin It

WWW
Something might be wrong with the gzipped file, I can't unzip it either.... "Unexpected end of file"

I could decompress the gzip file with 7zip, but not from the command line. So it does look like it was corrupt or 7zip just broke it.  Anyway, I removed that one and left the zip file.  I hope everyone can open the zip file Smiley

#14: 16-Nov-2007, 05:05 PM

Coding Team

sirlancelot
Posts: 576

PHP, XML, XSL Supporter

WWW
I could decompress the gzip file with 7zip, but not from the command line. So it does look like it was corrupt or 7zip just broke it.  Anyway, I removed that one and left the zip file.  I hope everyone can open the zip file Smiley
$ gzip -9 page-inserter.php

No need for 7zip Wink

Terminal > GUI

#15: 20-Nov-2007, 10:22 PM

ccheney
Posts: 47

WWW
awww man where were you a month ago when I did this manually!  I did indeed have a unordered list created for a presentation.  I really could of used this.  This will still come in very handy as projects come in that would require so many pages being added.  Thanks a lot! Kudos!
Pages: [1]   Go Up
0 Members and 1 Guest are viewing this topic.