iWeb FAQ - (alternative) Adding HTML

iWebFAQ.org

 

HTML Snippets are great but they don’t add the code where it’s supposed to be. Is there any alternative to add HTML code without having to do it manually? (Also works to add HTML to iWeb ’06)

La stessa pagina in italiano                             Die gleiche Seite auf Deutsch
 



The Intro:


You’re right. What HTML Snippets do is the following: An html snippet creates a new page in which the code you enter in the snippet is added to, this new page is embedded in the page you added the snippet to with an iFrame. Result: the code isn't even where it's meant to be.


For most people that will be satisfying/sufficient/good enough but in some cases it isn’t for me.


When I have an HTML Snippet on a page and I add the Statcounter code to all my pages using iTweak or iComment the code is added to every single snippet too. Thus a visit on that page with the HTML Snippet in it gets counted twice: first the page and second the snippet. Which is pretty annoying to me.


That’s why I now present you an alternative way to embed HTML in your iWeb created website.


The Solutions:


Solution 1: Manually editing HTML (not recommended)

Solution 2: Using MassReplaceIt

Solution 3: Using iTweak



Solution 1 - One solution would be editing the html code manually post-publishing.


To do that you have to open the published pages (.html) in a full-text- or an html-editor.

Search for where you want the code to be added to.

Paste the code when you did find the right spot.


Problem: Every time you publish you have to do it all over again. If you have a lot of codes and a lot of pages (and I do!) that’s pretty time consuming, thus that solution doesn’t work for me.



Solution 2 - The second solution is much better and works the same as the third solution:


1. Go here and Download MassReplaceIt (it’s free)

2. Open iWeb

3. In the page or in the pages you want to add the HTML code to, create a Text Box of the size of the result of the HTML code you want to add (if the code is a video or an iFrame you have to create a Text Box with the size of the video or the size of the page you want to display in the iframe unless you want to enable scrollbars)

4. In these Text Boxes enter a code or a word you’re sure it doesn’t appear anywhere else on your pages (I use BlueBlackWhiteNight1; BlueBlackWhiteNight2; BlueBlackWhiteNight3; ... one for each different html code, thus same html code=same code, because I’m sure that those appear only in the Text Boxes where I want to have the HTML code). Put this code Text Indent 2 px (Open the Inspector, go to the Text tab and choose List change the text indent to 2 px)

5. Publish your website to folder or iDisk

6. Open MassReplaceIt

7. In Find you enter BlueBlackWhiteNight1 or whatever

8. In Replace you enter the html code that has to go in the Text Box

9. You can set more than one Find&Replace at once if you want to add more than one

10. Save the Query and make it the default

11. In Files add the folder you publish to from iWeb or the iDisk folder (iDisk/Web/Sites folder)

12. Click “Replace” and the HTML code will be added

13. Re-run MassReplaceIt every time you (re-)publish


Important note about MassReplaceIt settings:

- In Options select Search=Contents, Location=Entire file/Filename, Options=Search whole words

  1. -In Preferences When adding a folder toa  search list=Add a folder, Search folder’s name and contents

  2. -In MassReplaceIt go to Mask click on "Add" "Search items whose:" select "Extension" From the other drop down menu select "is" and then type ".html" (without "") and click on "Add..." and select "All criteria, must be satisfied to search a file". Doing this speeds-up the process of searching.


To fix it on a page copy and paste the textbox in the main textbox of your page. Now if you add text the “Snippet” will move automatically with the page.


If MassReplaceIt didn’t work. If MassReplaceIt didn’t find any of the TextBoxes to replace with HTML codes. Read this MassReplaceIt & HTML troubleshoot page.



Solution 3 - The third solution works pretty much like the second one. But instead of using MassReplaceIt it uses iTweak.


1. Go to the iTweak page and download iTweak (it’s free)

2. Open iWeb

3. In the page or in the pages you want to add the HTML code to, create a Text Box of the size of the result of the HTML code you want to add (if the code is a video or an iFrame you have to create a Text Box with the size of the video or the size of the page you want to display in the iframe unless you want to enable scrollbars)

4. In these Text Boxes enter a code or a word you’re sure it doesn’t appear anywhere else on your pages (I use BlueBlackWhiteNight1; BlueBlackWhiteNight2; BlueBlackWhiteNight3; ... one for each different html code, thus same html code=same code, because I’m sure that those appear only in the Text Boxes where I want to have the HTML code). Put this code Text Indent 2 px (Open the Inspector, go to the Text tab and choose List change the text indent to 2 px)

5. Publish your website to folder or iDisk

6. Open iTweak

7. In Find you enter BlueBlackWhiteNight1 or whatever

8. In Replace you enter the html code that has to go in the Text Box

9. You can set more than one Find&Replace at once if you want to add more than one

10. Save the Search&Replace, next time you open the saved search&replace and don’t have to retype all the stuff in each time

11. Click on “Choose Published Site”

- If you publish to a folder choose the folder you publish to from iWeb

- If you publish to MobileMe select your iDisk/Web/Sites/ folder where iWeb publishes to.

If you can’t choose the iDisk because you don’t see it go to Finder/Preferences/Sidebar and check the box near the iDisk

12. Hit “Process Site” and you’re done.


Note: You have to run iTweak every time you re-publish from iWeb.


What is iTweak? and what is it good for? Have a look at this page

For further information and download on guimkie.com



iWebFAQ.org - Tutorials, Tips & Tricks is made with iWeb and for iWeb.

It’s presented by Cédric and hosted by HostExcellence.com


I would like you to give me feedback on this page by commenting here. Tell me if it's been helpful. If it wasn’t please tell me why. If you think something is missing please tell me what.



Thank you for visiting and supporting my website.


- Cédric -



 

SocialTwist Tell-a-Friend