Forum Moderators: mack

Message Too Old, No Replies

Performing the same task in many pages

Any way around Macros in Frontpage?

         

wolfadeus

12:41 pm on Aug 2, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I want to add a line of code to all my pages (g analytics) and wondered whether there is a way around macros using frontpage? I don't know how to use macros, but from what I read at the FP helpdesk online, they seem to be quite demanding regarding programming skills. Thanks,

W.

wolfadeus

5:49 pm on Aug 3, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Did I post at the wrong forum? Would anyone know a better source to request help from? Thanks,

W.

lexipixel

6:15 pm on Aug 3, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



You could use an "include" file...

The basic idea is that you create an HTML file that contains just the HTML needed to render the repeated content --- no <HTML>, <HEAD>, or <BODY> tags.. just the actual content and markup.

Example: (cut and paste the following to a file and name it "copyright.htm")

<hr>
<center>
<b>MY COMPANY</b><br>
123 Main St., Sometown, ST 12345<br>
Tel: 555-1212<br>
<small>
Copyright &copy;2006 My Company, all rights
reserved<br>
</small>
</center>
<hr>

Next, in any document you want the copyright notice to appear, you use the following;

<!--#include file="copyright.htm" -->

NOTE: the content of the HTML file (copyright.htm) will be inserted into the page at the point where the include directive appears.

For more info, search the web for "server side includes" or "SSI".

.

wolfadeus

9:15 pm on Aug 3, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks a lot, I think I wasn't clear with my request.

I am actually looking for a way to add the four lines of code for google analytics (a simple java script) to my >1000 pages without pasting it manually. Any suggestions on that?

lexipixel

9:55 pm on Aug 3, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I would write a script that does a recursive search of the site looking for all .HTML (.htm, shtml, etc) files and finds a tag that is common to them all (maybe the </head> tag or the </body> tag), and automate having the script add in the google code.

It should be about 20 lines of perl or less...

wolfadeus

10:12 pm on Aug 3, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thank you. This would be about 20 lines more than I could write/use - I was hoping for something like the Photoshop-Actions, where you record a series of tasks and can then apply them to an unlimited number of files...guess instead I'll have to cope/paste a lot one of the upcoming evenings.

W.

Alex_Miles

12:17 am on Aug 4, 2006 (gmt 0)

10+ Year Member



I use something called Simpli-File.

Set it to disallow symbols. I don't know what symbols are but allowing them gives weird results.

You tell it a directory and it will search and replace a text string in as many files as you like and you can select them by extension. Its what I would use, and its free unless you choose to pay for it.

lexipixel

12:47 am on Aug 4, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Remeber the rule:

"Live by cut and paste --- die by cut and paste"...

I would do a complete backup of the site before doing anything that affects so many pages.

.