newLISP wiki: some basics

Q&A's, tips, howto's
Locked
cormullion
Posts: 2038
Joined: Tue Nov 29, 2005 8:28 pm
Location: latiitude 50N longitude 3W
Contact:

newLISP wiki: some basics

Post by cormullion »

I couldn't resist any longer and decided to try out the newLISP wiki running on my local machine.

What I've done so far is this:

1: downloaded the newLISP wiki 4.0 and moved the contents of the 'wiki' folder into /Library/Webserver/Documents.

2: In System Preferences, I switched on Personal Web Sharing, which gives me the following 'URI' to use: http://192.168.0.3/.

3: In a web browser, I typed in 'http://192.168.0.3/'.

The result is a nice "Index of /" page, delivered by Apache. I can see index.cgi, logo.png, etc, and these all display nicely (as source) when I click on them, although index.cgi displays 'The requested URL /index.cgi was not found on this server.'.

So it's all very easy to use (thanks to Lutz and Apple).

But I don't know what to do now. What is step 4?

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Post by Lutz »

The Apache webserver has to be configured to permit running CGI files or try the newLISP webserver like this (in a terminal window).

Code: Select all

sudo newlisp -http -d 80 -w /Library/Webserver/Documents/wiki &
It will ask for your password. You have to use 'sudo' and the password because using port 80 requires it. Then in the browser type http://localhost/

Previously in /Library/Webserver/Documents/ you have done:

Code: Select all

sudo tar xzvf newlisp-wiki-4.0.tgz
My MacMini and MacBook came with a directory called 'Sites' in the home directory, and that is the directory I used to un-tar the wiki and then used:

Code: Select all

sudo newlisp -http -d 80 -w /Users/lutzmueller/Sites/wiki
I believe /Library/Webserver/Documents/ should not be used to store user files, but the Sites directory in your home directory.

ps: there is also a way to configure newLISP server on the Mac permanently using a setup the /etc/xinetd and /etc/services files. This is described in the Code Patterns document.

cormullion
Posts: 2038
Joined: Tue Nov 29, 2005 8:28 pm
Location: latiitude 50N longitude 3W
Contact:

Post by cormullion »

And it was looking so promising! ;-)

So I've moved the wiki folder to ~/Sites/wiki. Unfortunately:

Code: Select all

sudo newlisp -http -d 80 -w /path/to/Sites/wiki/
fails with

newLISP server setup on port 80 failed.

Trying without a port number works OK, though.

But surely I would have to tell the web browser to look in ~/Sites/wiki somehow...? It seems to be looking in /Library/Webserver still.

cormullion
Posts: 2038
Joined: Tue Nov 29, 2005 8:28 pm
Location: latiitude 50N longitude 3W
Contact:

Post by cormullion »

Ah, I've found the problem... Had to switch off Personal Web Sharing before running newlisp as http server... (OK, it seems obvious now... :-)

So this wiki business uses a completely different set up to the Mac's built-ini Personal Web Sharing stuff...

Now when I go http://localhost/index.cgi I get a web page! Hooray.

At this stage I reckon I can resume the documentation...

cormullion
Posts: 2038
Joined: Tue Nov 29, 2005 8:28 pm
Location: latiitude 50N longitude 3W
Contact:

Post by cormullion »

Another question: I'm trying to get an overview of this wiki, not getting in to formatting yet.

All the content goes into the pages directory, I gather. How does this handle subdirectories? I created a page in a subdirectory OK, and it displays, but it appears to cause problems when something like this is used:

http://localhost/index.cgi?search=folder1/test

;-> list or string expected in function replace : content

Obviously the '/' is the problem, but it half works, which puzzles me...

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Post by Lutz »

The wiki/pages directory should be exclusively managed by the wiki, don't create anything in there by other means.

Lutz

cormullion
Posts: 2038
Joined: Tue Nov 29, 2005 8:28 pm
Location: latiitude 50N longitude 3W
Contact:

Post by cormullion »

I don't get it - how do I get images and stuff into the system? Can't I add stuff to folders?

m i c h a e l
Posts: 394
Joined: Wed Apr 26, 2006 3:37 am
Location: Oregon, USA
Contact:

Post by m i c h a e l »

Hi cormullion,

Yes, you can make folders in your wiki directory (say, wiki/images/ and wiki/audio/) and refer to the files in them this way:
"audio/some-playlist/some-audio-file.mp3"
or:
"images/some-image.png"

Very clean.

I agree that it's a little hard to get into the mindset of newLISP wiki initially, but after a day or so, I was saying goodbye to thoughts of using some complicated, much-harder-to-learn site-builder.

It's once you begin to maintain the site that you start to appreciate how easy it is to do the various upkeep duties (backing up, restoring, creating and deleting pages, etc.). Every time I use it, I'm almost giddy :-)

m i c h a e l

tom
Posts: 168
Joined: Wed Jul 14, 2004 10:32 pm

Post by tom »

[image:pix/pic.png ]

is how I included an image in my newlisp wiki, but I had to upload it by hand ( I used scp) It can be a relative path. As far as I know, the pages directory doesn't handle subdirectories, and you can't upload anything but text to pages from the wiki itself.

cormullion
Posts: 2038
Joined: Tue Nov 29, 2005 8:28 pm
Location: latiitude 50N longitude 3W
Contact:

Post by cormullion »

Thanks - the nebulous dark mass is starting to solidify. Every page of text content has to be in pages/, then, so probably some sort of naming scheme is the way to go...

tom
Posts: 168
Joined: Wed Jul 14, 2004 10:32 pm

Post by tom »

cormullion wrote:Thanks - the nebulous dark mass is starting to solidify. Every page of text content has to be in pages/, then, so probably some sort of naming scheme is the way to go...
The only scheme the wiki understands is "text_file." You can bypass the wiki by putting files named like this directly into the pages directory, or the wiki does it automatically with [[text file]] from a browser's text field.

I just stuck an image in mine as a test, and the wiki complained when I tried to view it.


On another note, one enhancement I'd like to see would add subdirectory creation. The way nl wiki handles locking and protection and stuff is with the first line of wiki pages. The first line of a locked page would have [locked:password] on it. It would be cool if you could have

[locked:password] [sub:thisdir] [sub:sub:thatdir]

it would be a way to organize different users or catagories.

cormullion
Posts: 2038
Joined: Tue Nov 29, 2005 8:28 pm
Location: latiitude 50N longitude 3W
Contact:

Post by cormullion »

Having great fun here - newLISP wikiCMS is very clever - but I'm still coming up with dumb questions... ;-)

I've got some styles sorted out, and played with the template, so the menu appears on the left. The default template is set up more for wiki than CMS, so now I want to move towards CMS-mode by displaying a menu of relevant pages on the left, but not sure how to do this. Where would I put this, - instead of the following?

Code: Select all

<%
(if has-menu 
 (begin
  (println {<div>})
  (if (file? (append "pages/" page-name))
      (if is-protected
          (print {<p><a>Edit protected</a></p>})
          ; 
          (print {<p><a>Edit</a></p>})))
  (println {<p><a>Home</a></p>}
           {<p><a>Files</a></p>}
           {<p><a>Index</a></p>}
           {<p><a>Changes</a></p>}
           {<p><a>References</a></p>})
  (println {</div>})))
%>
Presumably I can use one of these:

[search:pattern] displays a table of pages with pattern in content
[title:pattern] displays a table of pages with pattern in title

but I don't want to put any weird pattern in the title, just so that the pages get listed...

Also, some misc questions: what's the "Left" page for? And what's the "nifty" DIV for?

Another question - I'm trying to work out what tools there are, and I put [title:z] in a page. The listing of files was this:

.DS_Store
Bottom_Bar
Browser_Title
Changes
Click_To_Edit_and_Create
Contacts
Copyright_Text
Default_Style
FeatureComments
Home
How_To_Customize
How_To_Edit_Text
How_To_Use_Advanced_Features
Left_Bar
News
Title_Text
Wiki_Link

Only one of these contains a z in the title? I'm also having trouble understanding [search:z] as well... it includes every file in pages/except 'contacts'... Am I misunderstanding something?

cormullion
Posts: 2038
Joined: Tue Nov 29, 2005 8:28 pm
Location: latiitude 50N longitude 3W
Contact:

Post by cormullion »

any thoughts ? i might have another go at this this week

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Post by Lutz »

Typically when you use newlisp-wiki more as a CMS than a Wiki you would close it up using the security open/closed uption in the setup menu.

This will make the standard menu on the bottom disappear completely. You could then hard code your important links into the template.html page using normal HTML <a>...</a> tags and not a newLISP function.

The 'Left' page is the rest of experimenting with a left side-bar appearing to the left of the content box. You would put a CSS division with code (HTML + newLISP) similar to class="bottombar" into your template.html.

Doing it this way would permit you have a left sidebar similar to manage as your "Title Text" and "Botom Bar" pages. Of course you could also just hardcode the stuff into template.html as described first in this post.

The "nifty corners" stuff is there to make the round corners on the newlisp.org home page. If you look into the source of the newlisp.org home page you see how this is done. This link explains you all about it:

http://www.html.it/articoli/nifty/index.html

Lutz

rickyboy
Posts: 607
Joined: Fri Apr 08, 2005 7:13 pm
Location: Front Royal, Virginia

Post by rickyboy »

Like cormullion, I'm looking into newLISP wiki 4.0, and I have a question. Why, when you opt for closed security, does each page not publish its title?

I removed this restriction in my version[*], because I wanted a closed system (one that only I updated) but I still wanted page titles (pagenames) displayed. However, I dislike having my own version of the code which I'll have to reconcile with the new official version, when that comes along.

Any thoughts? --Rick
___________________
[*] -- Here's my change in diff:

Code: Select all

<     (set 'has-pagename (and (not (find {\[(notitle|noname):\]} abody 512)) (= SETUP:security "open")))
---
>     (set 'has-pagename (not (find {\[(notitle|noname):\]} abody 512)))
(λx. x x) (λx. x x)

cormullion
Posts: 2038
Joined: Tue Nov 29, 2005 8:28 pm
Location: latiitude 50N longitude 3W
Contact:

Post by cormullion »

What would be the best technique for providing a default behaviour that could be easily overridden with a custom behaviour while still being easy to update when the main software is changed?

rickyboy
Posts: 607
Joined: Fri Apr 08, 2005 7:13 pm
Location: Front Royal, Virginia

Post by rickyboy »

cormullion wrote:What would be the best technique for providing a default behaviour that could be easily overridden with a custom behaviour while still being easy to update when the main software is changed?
Yeah, good question! When you find that out, you will become famous in software engineering circles, because I think they haven't found "the best technique" for that yet.

And I'd like to know, too, about this as regards newLISP wiki (to which cormullion was really referring), 'cause I have more changes than the one at #9142!!! Maybe Lutz has a technique in mind.

Any help Lutz? I'd hate for us all to have different versions of the software...
(λx. x x) (λx. x x)

cormullion
Posts: 2038
Joined: Tue Nov 29, 2005 8:28 pm
Location: latiitude 50N longitude 3W
Contact:

Post by cormullion »

I'm not in my comfort zone talking about this, but i know it's possible to redefine functions once they're defined elsewhere. For example, you can make your own code execute when 'println' is called, using 'constant'.

So 'all you need to do' (note optimistic use of quotation marks) is make your own versions of functions that provide the information used in the building of the web pages... What I'm not sure about is where those redefinition statements would go, and how much of the customizing could be done this way.

rickyboy
Posts: 607
Joined: Fri Apr 08, 2005 7:13 pm
Location: Front Royal, Virginia

Post by rickyboy »

cormullion wrote:So 'all you need to do' (note optimistic use of quotation marks) is make your own versions of functions that provide the information used in the building of the web pages... What I'm not sure about is where those redefinition statements would go, and how much of the customizing could be done this way.
Even so, you'd still have to square your redefined functions with the new version of the official software coming in the future; so the problem remains ... :-(
(λx. x x) (λx. x x)

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Post by Lutz »

What would be the best technique for providing a default behaviour that could be easily overridden with a custom behaviour while still being easy to update when the main software is changed?
There is an easy solution for your request with minimum code change. We introduce a new variable SETUP:never-show-title, which is either true or nil and use that :

Code: Select all

(set 'has-pagename (and 
                    (not (find {\[(notitle|noname):\]} abody 512))
                    (not SETUP:never-show-title))) 
The changes would be in the user defined function 'setup-dialog' (around line 213) and the CGI processing segment 'CGI:get "setupdone"' (around line 1226). You can either do it yourself and send me the file or wait until the next release of newlisp-wiki appears.

Lutz

rickyboy
Posts: 607
Joined: Fri Apr 08, 2005 7:13 pm
Location: Front Royal, Virginia

Post by rickyboy »

Schweeeeet!!!!

One of the pluses about using newLISP over other similar software is the responsiveness of the developer/gatekeeper -- this advantage probably doesn't get mentioned as often as it should. Thanks Lutz!

[Lutz, BTW I'll be in FL (Tampa & Miami) around late Dec, early Jan. I sure would like to meet you in person and buy you a beer, if I could then. :-)]

--Rick
(λx. x x) (λx. x x)

Locked