Turn on SSI includes in SP pages in Edit mode

Is it possible to turn on SSI includes in SP Pages in Edit mode?

Your comments are appreciated

TeamSite 7.3.1
Linux

Comments

  • Currently we have TeamSite 6.7.2SP2 in the Production env and in the process of migrating to 7.3.1.

    In 6.7.2 SP2 we are using below script to preview html includes in the SitePublisher pages - which works perfectly in Edit and Preview modes

    <BR />$(document).ready(function(){<BR /> if($("#nav li").length == 0){ <BR /> try{ <BR /> $(".include").each(function(i){ <BR /> var incParent = $(this).attr('id');<BR /> incParent = "#" + incParent;<BR /> var incStr = $(this).attr('id') + "_func";<BR /> var incFun = eval(incStr);<BR /> var url = incFun('/include_path');<BR /> <BR /> if (url.match('#')){<BR /> url = url.replace(/#/g,'/');<BR /> url = url.replace(/\*/g,'.');<BR /> }<BR /> <BR /> $.get(url, function(data){<BR /> if (data.indexOf(' var so = new SelectObj();<BR /> var so_props = '<SELECT name="'+so.selectname+'" id="'+so.selectid+'" class="'+so.selectclass+'"> if(so.hasMultiple==="Yes"){<BR /> so_props += 'multiple="multiple" size="5"';<BR /> }<BR /> so_props += '>'+data+'</SELECT>';<BR /> $(incParent)[0].outerHTML = so_props;<BR /> }<BR /> else{ <BR /> $(incParent).html(data);<BR /> }<BR /> });<BR /> });<BR /> }<BR /> catch(e){}<BR /> }<BR />});<BR />

    In 7.3.1 in the edit mode this script enters into try condition and ends without loading any of the includes.....script running in the edit mode is not able to identify any span and div tags.........

    Please help me understand if component fragments are not part of the edit page (Component fragments are not injected into edit page dom)
  • Please help me understand if component fragments are not part of the edit page (Component fragments are not injected into edit page dom)
    They're part of the page, but they're loaded asynchronously through AJAX. Your document.ready() obviously executes before that, which is why it doesn't find anything. Your approach is fundamentally flawed in that even if you delay your call, updating component datums causes only that component to refresh, not the whole page. If that were the case, your includes would not be loaded again.

    If your only requirement is to do server side inclusion of HTML fragments, you should actually keep it on the server side. Use a Java external to retrieve the content and inject it at the right place in your component XSL. This has the side effect of solving your edit mode problem.
  • Thanks a lot for your response.....But I'm trying to understand how it is working in 6.7.2 but not in 7.3.1
  • Thanks a lot for your response.....But I'm trying to understand how it is working in 6.7.2 but not in 7.3.1
    Well your Javascript is operating on a DOM that doesn't look anything like the final page, and is subject to change without notice. As such, if someone managed to get this working in edit mode previously, it's an unsupported hack at best. If it doesn't work now, it's probably because iwov made some changes to their edit mode DOM and/or edit mode processing. My suggestion is trying to steer you into an implementation that relies purely on supported APIs, which is thus upgrade safe.

    The upgrade safe version of your approach is to tell your users that the includes will only load in page preview. A general rule of thumb is to assume that your edit mode will render the same way as a user accessing your runtime with javascript disabled, and that's just the way the platform works (for good reasons).
TeamSite Developer Resources

  • Docker Automation

  • LiveSite Content Services (LSCS) REST API

  • Single Page Application (SPA) Modules

  • TeamSite Add-ons

If you are interested in gaining full access to the content, you can register for a My Support account here.
image
OpenText CE Products
TeamSite
APIs