PDA

Click to See Complete Forum and Search --> : Stupid Questen :(


Pebbycat
Oct 25th, 2001, 01:12 PM
This must be a very stupid questen:

I have made over 10 html pages with the same left and right side of the page the same, menu, next match & Practices, i was woundering if their is anyway to make a cgi script that will change all menu, next patch & practices things other then changing each html page?, a bit like newspro, but insted of news it you can change menu and others

JoshT
Oct 25th, 2001, 01:57 PM
You might be able to use Server-Side Includes.

scoutt
Oct 25th, 2001, 05:51 PM
I'm sure you could. but you would be better off using SSI like Josh said. a lot less hassle

sail3005
Oct 27th, 2001, 04:31 PM
to use them... <!--#include file="directory/file.txt"-->

beachbum
Oct 27th, 2001, 07:20 PM
Ok
I know that this isnt html but just in case it is useful. I threw together a little vb program that allows me to change stuff in all my web pages in one go instead of doing it thru html. This is more for the design phase but may be applicable if u change the individual pages and then reload to ur server.
Regards
Stuart

FORM CONTAINS;
1 Filelistbox, 2 command buttons and 1 label control

Dim MyPath As String
Dim FileLoop As Long
Dim MyString As String
Dim MyFile As String
Dim MyLen As Long
Dim MyFind As String
Dim MyReplace As String
Dim MyCopy As String
Dim MyLenCheck As Double
Dim MyCounter As Long

Private Sub Form_Load()
MyPath = "C:\My Documents\Webpage" 'Ur path

File1.Path = MyPath'Set the path of the file list box
File1.Pattern = "*.htm"'And type of files
FileLoop = File1.ListCount'How many files
MyCounter = 0
File1.ListIndex = MyCounter
End Sub

Private Sub Command1_Click()
File1.ListIndex = MyCounter

MyFile = MyPath & "\" & File1.List(MyCounter)
MyLen = FileLen(MyFile)

'Open the applicable page
Open MyFile For Input As #1
MyString = Input(MyLen, #1)
Close #1

'What u want to change
MyFind = "string to change from"
MyReplace = "string to change to"

'Replace 'find' with 'replace'
MyCopy = Replace(MyString, MyFind, MyReplace)
'Check to see that any items were found
MyLenCheck = (Len(MyCopy) - Len(MyString)) / (Len(MyReplace) - Len(MyFind))
Label1 = MyLenCheck

Command2.SetFocus
End Sub

Private Sub Command2_Click()
'Write the changed page back
Open MyFile For Output As #1
Print #1, MyCopy
Close #1

MyCounter = MyCounter + 1
Command1.SetFocus
If MyCounter >= FileLoop Then Command2.Enabled = False
End Sub

sail3005
Oct 27th, 2001, 07:29 PM
cool, good idea

chrismitchell
Oct 28th, 2001, 04:07 AM
Cheers beachbum you just answered a question that I was going to ask today... :) Thanks for that! :D

sail3005
Oct 28th, 2001, 10:22 AM
yeah, i am currently making something like this, with a web interface. :D