Menu not allowing new pages to be edited

General discussions about WebYep
Post Reply
martinjbull
Rank 1
Rank 1
Posts: 27
Joined: Mon Dec 13, 2010 9:01 pm

Menu not allowing new pages to be edited

Post by martinjbull » Wed Feb 09, 2011 1:31 am

I have created a standard WebYep menu in a template file, and when I click on the menu item instead of opening a new page for editing it throws the following error message:
I get a 'The page cannot be found' error on a blank page (with the usual stuff about "The page you are looking for might have been removed, had its name changed, or is temporarily unavailable.
Please try the following:" etc etc.
The url in the browser is http://www.gingergraphicdesign.com/jame ... DOC_INST=1, even though the page containing the menu is http://www.gingergraphicdesign.com/james2/index.php (not .html).
I have created many menus and pages in Softpress Freeway before with no issues. This is the first time I have tried this with a purchased template in Dreamweaver CS5. I have tried to work out why it is throwing this error but i am a designer more than a code ninja.
I can give more info as needed: here is my menu code:

Code: Select all

<div class="MyMenu">
        <script type="text/javascript">
/* <![CDATA[ */
var webyep_dOpenMenuTrees;

function webyep_sGetCSSClass(o)
{
   var sClass = "";
   sClass = o.getAttribute("class");
   if (sClass == undefined) sClass = o.getAttribute("className");
   if (sClass == undefined) sClass = "";
   return sClass;
}

function webyep_setCSSClass(o, sClass)
{
   o.setAttribute("class", sClass);
   o.setAttribute("className", sClass);
}

function webyep_bHasCSSClass(o, sClass)
{
   var sCurrentClass = webyep_sGetCSSClass(o);

   return sCurrentClass.indexOf(sClass) != -1;
}

function webyep_addCSSClass(o, sClass)
{
   var sCurrentClass = webyep_sGetCSSClass(o);
   webyep_setCSSClass(o, sCurrentClass + " " + sClass);
}

function webyep_removeCSSClass(o, sClass)
{
   var sCurrentClass = webyep_sGetCSSClass(o);
   var iPos = sCurrentClass.indexOf(sClass);
   if (iPos > 0) {
      var r = new RegExp(sClass);
      sCurrentClass = sCurrentClass.replace(r, "");
      sCurrentClass = sCurrentClass.replace(/  +/, " "); // remove double spaces
      webyep_setCSSClass(o, sCurrentClass);
   }
}

function webyep_getElementsByClassName(sClassName, sTag)
{
   var aElements, i, iC, iR = 0, aResult = [];
   aElements = document.getElementsByTagName(sTag);
   iC = aElements.length;
   for (i = 0; i < iC; i++) {
      oElement = aElements[i];
      if (webyep_sGetCSSClass(oElement).indexOf(sClassName) != -1) aResult[iR++] = oElement;
   }
   return aResult;
}

function webyep_oParent(oChild)
{
   var o = oChild.parentElement;
   if (o == undefined) o = oChild.parentNode;
   return o;
}

function webyep_bIsParent(oParent, oChild)
{
   var oElementsParent = webyep_oParent(oChild);
   var oParentsParent;
   while (oElementsParent && oElementsParent != oParent && (oParentsParent = webyep_oParent(oElementsParent))) {
      oElementsParent = oParentsParent;
   }
   return (oElementsParent == oParent);
}

function webyep_showHideMenuTree(iMenuID, iItemID)
{
   var aElements, i, oElement, sClass, oTitleItem, oTitleLink, oTreeElement;
   var sExpandedClass = "WebYepMenuTitleExpanded";
   var bAutoClose = false;
   var bDidOpen = false;

   oTitleItem = document.getElementById("WYMUTITLE" + iMenuID + iItemID);
   oTitleLink = oTitleItem.getElementsByTagName("a")[0];
   oTreeElement = document.getElementById("WYMUTREE_" + iMenuID + "_" + iItemID);
   if (webyep_bHasCSSClass(oTitleItem, sExpandedClass)) {
      webyep_removeCSSClass(oTitleItem, sExpandedClass);
      webyep_removeCSSClass(oTitleLink, sExpandedClass);
      oTreeElement.style.display = "none";
   }
   else {
      if (bAutoClose) {
         aElements = webyep_getElementsByClassName("WYMUTREE_", "ul");
         for (i = 0; i < aElements.length; i++) {
            if (!webyep_bIsParent(aElements[i], oTitleItem)) aElements[i].style.display = "none";
         }
         aElements = webyep_getElementsByClassName(sExpandedClass, "li");
         for (i = 0; i < aElements.length; i++) {
            if (!webyep_bIsParent(aElements[i], oTitleItem)) webyep_removeCSSClass(aElements[i], sExpandedClass);
         }
         aElements = webyep_getElementsByClassName(sExpandedClass, "a");
         for (i = 0; i < aElements.length; i++) {
            if (!webyep_bIsParent(webyep_oParent(aElements[i]), oTitleItem)) webyep_removeCSSClass(aElements[i], sExpandedClass);
         }
      }

      webyep_addCSSClass(oTitleItem, sExpandedClass);
      webyep_addCSSClass(oTitleLink, sExpandedClass);
      oTreeElement.style.display = "block";

      bDidOpen = true;
   }

   return bDidOpen;
}

function webyep_menuItemClick(iMenuID, sURL, sTarget)
{
   var aElements, i, sClass, oElement, oTarget;

      var aElements, oElement, rExp;
   aElements = document.all||document.getElementsByTagName("ul");
   rExp = /WYMUTREE_([0-9]+)/;
   dCookieValues = new Object();
   for (i = 0; i < aElements.length; i++) {
      oElement = aElements[i];
      aMatches = rExp.exec(webyep_sGetCSSClass(oElement));
      if (aMatches != null) {
         iThisMenuID = aMatches[1];
         sCookieName = "WEBYEP_OPENTREES" + "_" + iThisMenuID;
         if (dCookieValues[sCookieName] == undefined) dCookieValues[sCookieName] = "";
         if (oElement.style.display != undefined && oElement.style.display!= "none") {
            dCookieValues[sCookieName] += oElement.id + "|";
         }
      }
   }
   for (sCookieName in dCookieValues) {
      document.cookie = sCookieName + "=" + dCookieValues[sCookieName];
   }
      if (sTarget == undefined || sTarget == "" || sTarget == "_self") document.location = sURL;
   else {
      if ((oTarget = frames[sTarget]) != undefined && oTarget.document != undefined) oTarget.document.location = sURL;
      else if ((oTarget = document.getElementById(sTarget)) != undefined && oTarget.document != undefined) oTarget.document.location = sURL;
      else if (parent.frames != undefined && parent.frames[sTarget] != undefined) parent.frames[sTarget].document.location = sURL;
      else {
         var oW = window.open(sURL, sTarget, "");
         oW.focus();
      }
   }
}
/* ]]> */
</script>

<ul class="WebYepMenu">
<li class='WebYepMenuItem WebYepMenuFirstItem'><a class='WebYepMenuItem WebYepMenuFirstItem' href="index.html?DOC_INST=1" onclick="webyep_menuItemClick(0, 'index.html?DOC_INST=1', ''); return false;">Placerat laculis</a></li>
<li class='WebYepMenuItem'><a class='WebYepMenuItem' href="index.html?DOC_INST=2" onclick="webyep_menuItemClick(0, 'index.html?DOC_INST=2', ''); return false;">Vestibulum urna</a></li>
<li class='WebYepMenuItem'><a class='WebYepMenuItem' href="index.html?DOC_INST=3" onclick="webyep_menuItemClick(0, 'index.html?DOC_INST=3', ''); return false;">Fingilla quam</a></li>
<li class='WebYepMenuItem'><a class='WebYepMenuItem' href="index.html?DOC_INST=4" onclick="webyep_menuItemClick(0, 'index.html?DOC_INST=4', ''); return false;">Tellus lorem</a></li></ul>

<script type="text/javascript">
/* <![CDATA[ */
/* ]]> */
</script>      </div>

Sorry it is long!

The content of the menu data file is:

a:3:{s:7:"VERSION";i:1;s:7:"CONTENT";a:4:{i:0;a:2:{s:2:"ID";i:1;s:4:"TEXT";s:16:"Placerat laculis";}i:1;a:2:{s:2:"ID";i:2;s:4:"TEXT";s:15:"Vestibulum urna";}i:2;a:2:{s:2:"ID";i:3;s:4:"TEXT";s:13:"Fingilla quam";}i:3;a:2:{s:2:"ID";i:4;s:4:"TEXT";s:12:"Tellus lorem";}}s:4:"LIID";i:4;}

Clearly the browser is looking for a way to create or open a new page in respons eto these "ID" statements but something is going amiss.

Can anyone assist? Thank you.

marcus
Objective Development
Objective Development
Posts: 170
Joined: Tue Nov 30, 2010 1:25 pm

Re: Menu not allowing new pages to be edited

Post by marcus » Wed Feb 09, 2011 11:41 am

This sounds as if you've put "index.html" as the menu's target in your code like so:
<?php webyep_menu("Fieldname", false, "index.html", "", "", ""); ?>

instead of writing
<?php webyep_menu("Fieldname", false, "index.php", "", "", ""); ?>

Please check your code in DW and also please wrap longish pieces of code in [code] tags, so readers wont be crushed by a wall of text! ;)

martinjbull
Rank 1
Rank 1
Posts: 27
Joined: Mon Dec 13, 2010 9:01 pm

Re: Menu not allowing new pages to be edited

Post by martinjbull » Wed Feb 09, 2011 11:50 am

OK Marcus-Thanks. I did what you said and this solved it immediately.

Sorry about the code-I am not too hot on the netiquette of forums... Won't do it again!

martinjbull
Rank 1
Rank 1
Posts: 27
Joined: Mon Dec 13, 2010 9:01 pm

Re: Menu not allowing new pages to be edited

Post by martinjbull » Wed Feb 09, 2011 1:05 pm

This has proved a fortunate problem as I had not realised that this ability to specify different templates for the menu existed in WebYep... well this opens up a new world!
Marcus (or anyone else out there)-I have a question:
in Dreamweaver the code inserted is

Code: Select all

<?php webyep_menu("Right_Menu", false, "about.php", "", "", ""); // WebYepV1 ?>

What is the purpose of the three parentheses? By this I mean the part of the code that reads

Code: Select all

"","",""
Are these to accept inline styling?
Please excuse the novice code knowledge but I am eager to learn.

Martin

marcus
Objective Development
Objective Development
Posts: 170
Joined: Tue Nov 30, 2010 1:25 pm

Re: Menu not allowing new pages to be edited

Post by marcus » Wed Feb 09, 2011 3:21 pm

martinjbull wrote:... in Dreamweaver the code inserted is

Code: Select all

<?php webyep_menu("Right_Menu", false, "about.php", "", "", ""); // WebYepV1 ?>

What is the purpose of the three parentheses?
Are these to accept inline styling?

The first one is an optional parameter to specify a target frame. You won't need it, unless you are using a frameset for your page.
The last two are remains from former versions and are there only for backward compatibility.

Styling is done with CSS. Inline styling for menus is not supported (and won't be necessary). Even rather complex styling can be done by only using external style sheets as seen here.

For a complete reference please refer to the WebYep documentation, which you'll find by following this fine and elegantly crafted link. :D

martinjbull
Rank 1
Rank 1
Posts: 27
Joined: Mon Dec 13, 2010 9:01 pm

Re: Menu not allowing new pages to be edited

Post by martinjbull » Wed Feb 09, 2011 5:16 pm

Marcus
Thank you. I stay away from inline styles as much as posssible but I was curious, seeing all these ''" things everywhere!
I see that there is some horizontal menu code available too now as a demo-very interesting.

Thank you very much for the fine handcrafted link, which I have printed off so I can treasure it... :wink:

Post Reply