Nov 20, 2008, 07:06 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
Search via SMF or Google: modx forums all of modxcms.com web
  MODxCMS.com   Forums   Help Login Register  
Pages: [1]   Go Down
  Print  
Author Topic: CODE: How to Make MODx Pages from an HTML List  (Read 2063 times)
0 Members and 1 Guest are viewing this topic.
devtrench
Jr. Member
*
Posts: 49



WWW
« on: Nov 14, 2007, 02:37 PM »

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 127 times.)
« Last Edit: Nov 16, 2007, 12:11 PM by devtrench » Logged

dev_cw
Testers
*
Posts: 2,693



WWW
« Reply #1 on: Nov 14, 2007, 03:04 PM »

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.
Logged

Shane Sponagle | Snippet Call Anatomy | Document Specific Variables

Something is happening here, but you don't know what it is.
Do you, Mr. Jones?  -  [bob dylan]
devtrench
Jr. Member
*
Posts: 49



WWW
« Reply #2 on: Nov 14, 2007, 03:19 PM »

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
Logged

chinesedream
Sr. Member
****
Posts: 283


« Reply #3 on: Nov 15, 2007, 02:33 AM »

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

Thanks!
Logged
sottwell
Documentation Team
*
Posts: 8,170



WWW
« Reply #4 on: Nov 15, 2007, 03:22 AM »

http://www.7-zip.org/
Logged

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
chinesedream
Sr. Member
****
Posts: 283


« Reply #5 on: Nov 15, 2007, 03:34 AM »


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.
Logged
sottwell
Documentation Team
*
Posts: 8,170



WWW
« Reply #6 on: Nov 15, 2007, 04:31 AM »

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
Logged

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
devtrench
Jr. Member
*
Posts: 49



WWW
« Reply #7 on: Nov 15, 2007, 12:07 PM »

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
Logged

chinesedream
Sr. Member
****
Posts: 283


« Reply #8 on: Nov 15, 2007, 02:57 PM »


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)
Logged
chinesedream
Sr. Member
****
Posts: 283


« Reply #9 on: Nov 15, 2007, 03:16 PM »

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.
Logged
ChuckTrukk
Committed to MODx
*****
Posts: 632



WWW
« Reply #10 on: Nov 16, 2007, 09:57 AM »

i use Unarchiver on osx. its small, free, and quick. And i havent found a filetype it doesnt open.
Logged

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
sirlancelot
Coding Team
*
Posts: 572


Eats PHP for breakfast.


WWW
« Reply #11 on: Nov 16, 2007, 11:23 AM »

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

devtrench
Jr. Member
*
Posts: 49



WWW
« Reply #12 on: Nov 16, 2007, 12:13 PM »

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
Logged

sirlancelot
Coding Team
*
Posts: 572


Eats PHP for breakfast.


WWW
« Reply #13 on: Nov 16, 2007, 05:05 PM »

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
Logged

ccheney
Jr. Member
*
Posts: 38


WWW
« Reply #14 on: Nov 20, 2007, 10:22 PM »

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!
Logged

Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP

Copyright © 2005-2008 MODxCMS, All rights reserved. Contact Us
Styles by ziworks.com

Powered by SMF 1.1.4 | SMF © 2005, Simple Machines LLC

Valid XHTML 1.0! Valid CSS!