Pages: [1] |
|
|
Author |
Topic: Adding Head Code (Read 189 times) |
Brandon
Posts: 4
|
Good day folks !! ... I just upgraded my version to the latest "lite" version and I have a concern that I hope someone will be able to help me out with. I have the files on the site that the client needs to "adjust as includes without head info , or closing body tags .. its just the body content ... every time the client goes to change something .. its adding the full html to the file ( your prev version did not do this ) ... I see there is a way to not have the WYSIWYG editor to be forced off but my client is not that savvy with raw code and needs a WYSIWYG type interface ... The site is quite large and would take a tonne of time to convert over to straight pages. Its a Church site and I volunteer to do some HTML work for them ..b ut they need to be able to update the pages themselves .. and with it doubling up on the code .. its leaving pages blank
Any help with this would be GREATLY appreciated
Thank you all in advance
Brandon
|
|
|
|
Jenkinhill
|
Brandon, the usual problem that people have is in placement of the Snippet start and end tags. I suspect you may have the tags around the whole file - or are using the whole file editing mode rather than the snippet editing mode. The codesweeper in the editor will try to create a valid XHTML file which will include head etc if you try to edit a full file with it.
Assuming that the files are enclosed in div tags, just place the start tag immediately after the <div id="whatever"> and the end tag immediately before the relevant </div>.
|
Kelvyn
|
|
|
Brandon
Posts: 4
|
Thank you for getting back to me so quickly on this ... maybe I didnt make my situation very clear ... Ive been working with Snippet for 4 years and it has worked fine before ... I just installed the latest version on a clients site .. I use includes for this site because there is many places where the content needs to be updated. Includes do not have any head data ... such as:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>Untitled document</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
Nor the closing tags :
</body>
</html>
Now .. when I ( or my client ) goes to edit these template files ... it adds the head data and closes it .. for example:
Starting Code before editing in snippet:
<p>Content of include goes here</p>
<ul>
<li>Point 1</li>
<li>Point 2</li>
<li>Point 3 </li>
</ul>
What Snippet saves the include as after editing it:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>Untitled document</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<p>Content of include goes here</p>
<ul>
<li>Point 1</li>
<li>Point 2</li>
<li>Point 3 </li>
</ul>
</body>
</html>
Soooooo ... the issue is ... seeing im editing an include ... after saving it the page now has 2 head data .. and 2 body and html closing tags ... is there ANY way to force Snippet to not add this code ??
Thanks once again
Brandon
|
|
|
|
admin
Forum Administrator

Posts: 2086
SnippetMaster Author
|
Hello,
As long as you are choosing to edit the file using the "WHOLE FILE" option in the drop down list... then the wysiwyg editor will add the HTML opening and closing tags.
What you must do is use the "Snippet Tag" feature of SnippetMaster, so that the editor will load your HTML code into the editor and will NOT add the HTML opening/closing tags.
Here is how you can "mark" your HTML code as Editable Regions (snippets):
http://www.snippetmaster.com/documentation/snippet-tags.html
Then, when you choose to edit the page, be sure to select the blue SNIPPETS from the dropdown menu instead of the WHOLE PAGE.
Let me know if you get stuck with anything.
|
|
|
|
Brandon
Posts: 4
|
Ahhhhhhhhh ... the light bulb goes off in my head LOL ( thanks to you Admin ) .. What I forgot to show you in my last post was that Since I had an older version it is using :
<SNIPPET NAME="Snippet_name">
</SNIPPET>
Not your new snippet tags ... I added a new snippet tag to one of the pages and POOF ... I now see the "snippets" menu in the drop down ... my next task is to replace allllll of the snippet tags ( on a few hundred pages ) with the new code
Thank you so much for your help on this !
Take care
Brandon
|
|
|
|
admin
Forum Administrator

Posts: 2086
SnippetMaster Author
|
Hello,
A good system administrator should be able to do the replacement for all your files with a few lines of "scripting" code.
ie: replace "</snippet>" with "<!-- #EndSnippet -->"
etc...
It should be fairly straightforward to do that, so it only takes a few minutes instead of a huge manual effort.
|
|
|
|
Brandon
Posts: 4
|
well I can do it with find and replace also ... but ... I have named each snippet open tags ( in the old format ) a different name .. the end tags are the easy ones LOL .. the open snippet are the tricky ones
Cheers - Brandon
|
|
|
|
admin
Forum Administrator

Posts: 2086
SnippetMaster Author
|
You can do this using AWK on the unix side. There are some windows tools that can do this, too. PHP can also do it...
ie: If you have:
<SNIPPET NAME="Snippet_name">
You can "read" the contens of all your html files, line by line.
Then check if the line contains a "<SNIPPET" text.
If yes, then get everything into a variable starting from the "<" character and ending with the ">" character.
Now delete the "<SNIPPET " characters,and then ending ">" character. You should now have the "contents" of the snippet only.
You should now be able to add the new snippet tag style to the begginging and end of your old snippet contents and this should result in a new snippet opening tag.
Not perfect, but I hope that helps. 
|
|
|
|
|
Pages: [1]
|
|
|
|