douti8321 2015-07-08 13:56 采纳率: 0%
浏览 30

如何避免在联系人类别中显示jos-Error?

Welcome! I have a problem with displaying error page when category contacts is clicked. I will briefly describe the situation and circumstances:

  • I wanted to achieve a fully functional contact form with selection of the person you want to write (description of page + dropdown list to chose contact + contact form on a single page). This is achieved by:
    • Each contact (e.g. ContactA, ContactB) is assigned to contact categories (e.g. ContactC);
    • Creating a menu item (e.g. ContactUs) with the type: single contact;
    • Selecting a "default" contact (Select Contact:) ContactA;

The site looks and functions as it should at this stage of development - after selecting a specific contact - sends a letter where it should be sent (still requires overwriting layout, but not the point).

  • When you select (other than default) contact from the dropdown list (ContactB) the page is reloaded - it is necessary to change the recipient.
  • Breadcrumbs changes after reloading by adding extra levels - contact and contact categories (e.g. "HOME->ContactUs" to "HOME->ContactUs->ContactC->ContactB"). Which itself doesn't look bad, but I would avoid this levels.
  • When a curious visitor clicks on ContactC in breadcrumbs - this page reloads and has an address mypage.com/index.php/contactus/10-contactc/3-contactb where numbers are equivalent to ID of the elements;
  • And displays the error message "jos-Error: Contact not found" where error information is in the translation under the label COM_CONTACT_ERROR_CONTACT_NOT_FOUND.

My question is: how to avoid displaying this error? I see three solutions:

  • Writing a php function (e.g. in error.php), which detects occurrence of this specific error and (for example) redirects to the start page - I don't know nor references to use or if "I can".
  • Turning off in breadcrumbs displaying contact categories (checked in global configuration and contact options, but nothing changes on page).
  • Setting in the css specifically for this one link visibility: hidden (or if "I can" php give css class by search for the value of href?).

I've got Joomla 3.4.x and mysql database.

  • 写回答

1条回答 默认 最新

  • dpaal28266 2015-07-08 17:26
    关注

    I have achieved this third solution using jQuery. (I know this is not the best, general solution, but it works for me, so it's not THAT stupid in the end.) It looks like this:

    jQuery(document).ready(function(){
      //get link by end//
      var contactC = $('a[href$="contactus/10-contactc"]');
      //get parent of link*//
      var contactCParent = contactC.parent(); 
      //add parent of link class//
      contactCParent.attr( "class", "hiddenCat" );
    });
    

    and in CSS I have extra lines:

    .hiddenCat {
      display: none;
    }
    

    Helpful links:

    How to get element by href in jquery

    jQuery find all elements by part of the id attribute

    jQuery attr add id to existing element

    jQuery Api - parent()

    jQuery Api - attr()

    /*/ I had to find a parent, otherwise Joomla displays two span-dividers ("HOME->ContactUs->->ContactB").

    评论

报告相同问题?

悬赏问题

  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
  • ¥500 火焰左右视图、视差(基于双目相机)