I need to add a user control in master page in SharePoint designer 2013.
I have checked out the file and added the line below to it
<!--SPM:<%#Register TagPrefix="LogOut" TagName="LogOutUserControl" Src="~/_controltemplates/15/UC_LogOut/LogOut.ascx" %>-->
Now this should reflect in the master file also but after refreshing I can't see this control (comment) there in master page.
I also checked it in then also can't see this control. Any help would be appreciated.
After checking-in the master page it needs to be published (I assume this is already the case since it is an existing one) an approved.
If you are on a multi web front end environment check that the change is propagated to all front ends accordingly.
Also note, as already mentioned by Stevangelista, that you just added a <!-- comment --> and not a control as you called it. You should revise your tag there... I assume you intended to do something like this:
<!-- ... -->
<%#Register TagPrefix="LogOut" TagName="LogOutUserControl"
Src="~/_controltemplates/15/UC_LogOut/LogOut.ascx" %>
<html>
<!-- head -->
<body>
<!-- ... -->
<LogOut:LogOutUserControl runat="server">
<!-- ... -->
</body>
</html>
Note that this is untested and that you should verify the code in is snippet!
Related
The images do not show on page after publishing the web-application on IIS.
When I run the web-application from Visual Studio 2015, the pictures are appear correctly.the path of image is like
/media/1713/mypicture.png
But after publishing the web-application on IIS and run it, the pictures do not show.
But when I add manually the domain at first of above path, the image show correctly. same as
/domain-name/media/1713/mypicture.png.
I've used Umbraco 7.4.3, ASP.NET MVC, VS2015 and Windows 10.
EDIT: I UPGRADED IT TO UMBRACO 7.5.4 BUT STILL THERE IS THE PROBLEM.
:(
How can I solve this problem? Please help me.
umbracosettings.config:
<?xml version="1.0" encoding="utf-8" ?>
<settings>
<content>
<errors>
<error404>1</error404>
</errors>
<notifications>
<!-- the email that should be used as from mail when umbraco sends a notification -->
<email>your#email.here</email>
</notifications>
<!-- Show property descriptions in editing view "icon|text|none" -->
<PropertyContextHelpOption>text</PropertyContextHelpOption>
<!-- The html injected into a (x)html page if Umbraco is running in preview mode -->
<PreviewBadge>
<![CDATA[<a id="umbracoPreviewBadge" style="position: absolute; top: 0; right: 0; border: 0; width: 149px; height: 149px; background: url('{1}/preview/previewModeBadge.png') no-repeat;z-index: 9999999;" href="#" OnClick="javascript:window.top.location.href = '{0}/endPreview.aspx?redir={2}'"><span style="display:none;">In Preview Mode - click to end</span></a>]]></PreviewBadge>
<!-- Cache cycle of Media and Member data fetched from the umbraco.library methods -->
<!-- In seconds. 0 will disable cache -->
<UmbracoLibraryCacheDuration>1800</UmbracoLibraryCacheDuration>
<!-- How Umbraco should handle errors during macro execution. Can be one of the following values:
- inline - show an inline error within the macro but allow the page to continue rendering. Historial Umbraco behaviour.
- silent - Silently suppress the error and do not render the offending macro.
- throw - Throw an exception which can be caught by the global error handler defined in Application_OnError. If no such
error handler is defined then you'll see the Yellow Screen Of Death (YSOD) error page.
Note the error can also be handled by the umbraco.macro.Error event, where you can log/alarm with your own code and change the behaviour per event. -->
<MacroErrors>throw</MacroErrors>
<!-- These file types will not be allowed to be uploaded via the upload control for media and content -->
<disallowedUploadFiles>ashx,aspx,ascx,config,cshtml,vbhtml,asmx,air,axd,swf,xml,html,htm,svg,php,htaccess</disallowedUploadFiles>
<!-- Defines the default document type property used when adding properties in the back-office (if missing or empty, defaults to Textstring -->
<defaultDocumentTypeProperty>Textstring</defaultDocumentTypeProperty>
</content>
<security>
<!-- set to true to auto update login interval (and there by disabling the lock screen -->
<keepUserLoggedIn>false</keepUserLoggedIn>
<!-- change in 4.8: Disabled users are now showed dimmed and last in the tree. If you prefer not to display them set this to true -->
<hideDisabledUsersInBackoffice>false</hideDisabledUsersInBackoffice>
</security>
<requestHandler>
<!-- this will ensure that urls are unique when running with multiple root nodes -->
<useDomainPrefixes>false</useDomainPrefixes>
<!-- this will add a trailing slash (/) to urls when in directory url mode -->
<addTrailingSlash>true</addTrailingSlash>
</requestHandler>
<templates>
<!-- To switch the default rendering engine to MVC, change this value from WebForms to Mvc -->
<defaultRenderingEngine>Mvc</defaultRenderingEngine>
</templates>
<scheduledTasks>
<!-- add tasks that should be called with an interval (seconds) -->
<!-- <task log="true" alias="test60" interval="60" url="http://localhost/umbraco/test.aspx"/>-->
</scheduledTasks>
<!-- distributed calls must be enabled when using Umbraco in a load balanced environment -->
<distributedCall enable="false">
<!-- the id of the user who's making the calls -->
<!-- needed for security, umbraco will automatically look up correct login and passwords -->
<user>0</user>
<!--
When distributed call is enabled, you need to add all of the servers part taking in load balancing
to the server list below.
-->
<servers>
</servers>
</distributedCall>
<web.routing
trySkipIisCustomErrors="false"
internalRedirectPreservesTemplate="false" disableAlternativeTemplates="false" disableFindContentByIdPath="false"
umbracoApplicationUrl="">
</web.routing>
</settings>
I've used img tag in my cshtml file like this:
<img style="display: block;" src="#Model.Model.MainPicture" alt="#Model.Model.FirstTitle">
Sometimes if you add images in project not in usual way to include, it will not update images in build/packages, which you are submitting to IIS. Make your image in solution explorer, right click the image in solution explorer and choose properties then select "Copy always" and build project. Then publish to IIS.
Is there a plugin available for Gulp that does the same thing as Assemble does for Grunt?
I would like to run a task for Gulp that assembles HTML partials, but I cannot find a plugin. Has anyone used one and can you provide a link to it?
UPDATE: 4/21/2016
Lately, I've been using Twig.js with Gulp, along with gulp-data to render JSON in my templates. My article goes into detail. Hint: You could also use Nunjucks, Swig.js, Handlebars etc.
Article: Frontend templating with Gulp and Twig.js
Yes, you can do it with this plugin called gulp-file-include
Example :
# index.html
<!DOCTYPE html>
<html>
<body>
##include('./view.html')
##include('./var.html', {
"name": "haoxin",
"age": 12345
})
</body>
</html>
# view.html
<h1>view</h1>
# var.html
<label>##name</label>
<label>##age</label>
I made a plugin to extend html files https://www.npmjs.org/package/gulp-html-extend
master.html
<body>
<!-- ##placeholder=content -->
<!-- ##placeholder=footer -->
</body>
content.html
<!-- ##master=master.html-->
<!-- ##block=content-->
<main>
my content
</main>
<!-- ##close-->
<!-- ##block=footer-->
<footer>
my footer
</footer>
<!-- ##close-->
output
<body>
<!-- start content -->
<main>
my content
</main>
<!-- end content -->
<!-- start footer -->
<footer>
my footer
</footer>
<!-- end footer -->
</body>
It may help you.
I would like to add one more:
I use gulp-preprocess. It is great for building not only html, but also JavaScript, and can even be used in PHP.
It has simple directives:
<!-- #include filename.extension -->
<!-- #ifdef foo -->
Included html if foo is defined
<!-- #endif -->
Also #ifndef (not defined)
Variables
<!-- #echo bar -->
Or even cooler:
link
Also (as far as I can tell) unlimited sub inclusion:
<!-- I am an included file -->
<!-- #include relative/to/me/data.html -->
I have a directory tree like so:
./project root
- build/
- less/
[less,..]
- html/
- index/
Index-variables.json
[Index-partials.html,...]
Index.html
[other-build-folders,..]
- dist
[htmlfiles,...,CSS folder,...]
For each rendered html file, I have a corresponding file in the build folder and a corresponding folder for that file name. The build file listens for changes in the corresponding folder and preprocesses that data which then outputs to the matching file in the dist folder.
Since preprocess allows you to pass variables as a context object, I pass variables stored in a JSON file in the parent build folder, .e.g. index-variables.json, overwriting any global variables I've defined.
I use it with Livereload,so the upshot is that everytime I make a change in any html partial the page reloads almost instantly with the rendered html - we're talking less than 1 second. In addition to being lightening fast, preprocess seems really stable-I've never had a bug.
This is an awesome way to work.
Assemble now supports Gulp: https://github.com/assemble/assemble although at the time of posting the official Assemble website doesn't mention this, and there is very little in the way of documentation.
You can do it with a gulp plugin called gulp-handlebars-file-include
This is a very good plugin, because it dose not create or make a custom parser like, gulp-file-include, nor define a new syntax. Instead it use handlebars, therefore, it not only parse with handlebars, but also you can compile your partials files with handlebars and even include your own handlebars helpers.
I am currently working on generating a master page for a sharepoint instance. It is however giving some issues when attempting to convert over an ASP repeater
The following works in generating a repeated text:
<!--MS:<asp:Repeater ID="TopMenu" runat="server" DataSourceID="selectedSiteMap">-->
<!--MS:<HeaderTemplate> -->
<!--ME:</HeaderTemplate> -->
<!--MS:<ItemTemplate> -->
<li>test</li>
<!--ME:</ItemTemplate> -->
<!--MS:<FooterTemplate> -->
<!--ME:</FooterTemplate> -->
<!--ME:</asp:Repeater> -->
<!--MS:<asp:SiteMapDataSource SiteMapProvider="CurrentNavigation" ShowStartingNode="false"
StartFromCurrentNode="false" StartingNodeOffset="0" StartingNodeUrl="sid:1002"
EnableViewState="true" ID="selectedSiteMap" runat="server" /> -->
However the following does not work:
<!--MS:<asp:Repeater ID="TopMenu" runat="server" DataSourceID="selectedSiteMap">-->
<!--MS:<HeaderTemplate> -->
<ul id="main_menu_ul" class="">
<!--ME:</HeaderTemplate> -->
<!--MS:<ItemTemplate> -->
<li><a href=<!--MS:"<%# Eval("Url")%>"--> class="link">
<!--MS:<%# Eval("Title")%>--></a></li>
<!--ME:</ItemTemplate> -->
<!--MS:<FooterTemplate> -->
</ul>
<!--ME:</FooterTemplate> -->
<!--ME:</asp:Repeater> -->
<!--MS:<asp:SiteMapDataSource SiteMapProvider="CurrentNavigation" ShowStartingNode="false"
StartFromCurrentNode="false" StartingNodeOffset="0" StartingNodeUrl="sid:1002"
EnableViewState="true" ID="selectedSiteMap" runat="server" /> -->
So far I have identified the issue is 2 fold:
1. the converter is does not like the fact that the opening ul and closing ul dont exactly match
2. the converter does not like the eval tags at all.
Any help anyone could give to getting this repeater to work properly would be very helpful. Thank you
The other possibility is that you are manually uploading your master page (as opposed to deploying it using a feature). The <%# Eval("Url")%> tag is seen as server-side code, and it turns out that there is a security limitation that server-side code is not allowed in customized pages - in other words, ones that are unghosted.
So if you customize a master page using SharePoint designer, the new copy exists in the content database, and this is regarded as customized.
I hit this recently - deployed an aspx master page (with a repeater control in it) using a feature, download a copy, re-upload it (with no changes) and bang - error. Code blocks not allowed in this file.
As you're putting this in an html master page, you're probably just masking the real reason for the error. You could try adding an entry to the web.config (see, for example, this blog) to specify that your master page can have code blocks.
It might because You have opened
MS: before you Eval("") but there is no closing ME: after eval tag.
I have a Sharepoint site with a Master Page that has a main content area and a sidebar content area.
In one of my pages I have the need to allow the user to edit the content of the main content area and the sidebar content area from the Edit mode.
Currently, in the HTML of one of my pages, in main content area of a page (inside <asp:Content ContentPlaceHolderId="PlaceHolderMain" runat="server">) i have the follow code snippet which appears to allow a HTML edit box in Edit mode.
<SharePoint:EmbeddedFormField id="wikiField" FieldName="wikiField" ControlMode="Display" runat="server" />
I have tried to replicate this inside the <asp:Content ContentPlaceHolderId="PlaceHolderSidebar" runat="server"> tag, but this simply displays the content of my main body content and does not give me the option to edit this.
When a user enters Edit mode, I need to display two rich text HTML editors, one for the main content and one for the sidebar. What HTML tags will allow me to achieve this?
I do not have access to SharePoint Designer 2013 and cannot install it for reasons I will not go into.
Thanks
Try using this:
<PublishingWebControls:RichHtmlField FieldName="PublishingPageContent" HasInitialFocus="True" MinimumEditHeight="400px" runat="server"/>
And add a reference to this if it's not already at the top of your master.
<%# Register Tagprefix="PublishingWebControls" Namespace="Microsoft.SharePoint.Publishing.WebControls" Assembly="Microsoft.SharePoint.Publishing, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
You may need to activate the publishing feature for this - I can't remember if it works without it or not.
I have a Jsp that dynamically needs to get included in entire project as user opens any jsp. i.e. As a user opens a jsp my jsp should automatically gets included.
I have written this in web.xml in Tomcat
<jsp-property-group>
<url-pattern>/webapps/ROOT/html/*.jsp</url-pattern>
<url-pattern>*.jspf</url-pattern>
<el-ignored>false</el-ignored>
<scripting-invalid>false</scripting-invalid>
<is-xml>false</is-xml>
<include-prelude>/WEB-INF/jsp/tracker.jsp</include-prelude>
<!-- <include-coda>/template/coda.jspf</include-coda> -->
</jsp-property-group>
I had kept my jsp in tomcat under WEB-INF/jsp/ and i want to include it into every porject as it contains a code that tracks log for user.
Or any other way to make this happen.
Thanks.
There is one more way to include your JSP for the whole portal and i.e. the dockbar.
You can create a hook and include your jsp in the /html/portlet/dockbar/view.jsp using either <jsp:include /> or <liferay-util:include /> or simple <%# include file="" /> (this would be static).
<jsp:include page="/jsp/yourJSPPageToBeIncluded.jsp" />
OR
<liferay-util:include page="/jsp/yourJSPPageToBeIncluded.jsp" />
OR
<%# include file="/jsp/yourJSPPageToBeIncluded.jsp" />
Note: the path may differ depending on where you will be putting the JSP.
Why I am choosing dockbar is because it is present on all the portal-pages of liferay. This won't work if you are opening a pop-up like configuration pop-up or look-and-feel pop-up or other custom dialog pop-ups since dockbar is not present in the pop-up. For using in pop-ups you would have to override portal_pop_up.vm in your custom-theme and write the code as suggested by #VikasV
$theme.include($themeServletContext, "/jsp/yourJSPPageToBeIncluded.jsp")
There are two ways for this.
Simple way is to include your JSP in the Theme. When your Theme is applied to your project, and when Theme is rendered, any pages in your project will render this included JSP.
Code sample below. This has to be placed in vm file(navigation.vm).
$theme.include($themeServletContext, "/jsp/yourJSPPageToBeIncluded.jsp")
Here, JSP folder is placed directly inside Theme war.
Other way (tedious one), is to include this JSP in each and every JSP page that you want this to be included.
Use <jsp:include> element for this.
Some references,
Ref1
Ref2