Any idea about inserting html to SharePoint? - sharepoint

I'm trying to insert piece of my html code(which is actually working in my local html file) in SharePoint. But it is not accepting all my tags which are there in the code, for eg: 'style' tag.
Any help is greatly appreciated. :)

Open page for edit. Then from "Media and Content" group choose "Script Editor" web part. And then click Edit Snipper and paste your html code there.
You can also use Content Editor web part and provide link to your html code.
If you want to change style for whole SharePoint you can modify Master Page or providing Alternate CSS for exiting one (this is possible in Central Administration).

Related

Create a system to edit texts of a website

Hello I'm making a website and I want that an user can edit some of the texts content in the website, clicking a button "Save" and the changes are permanent.
I suppose I have to put all the text in a database instead of keeping it in html code, but this will slow down the website loading performance.
Is there a library to easily achieve this functionality? Pheraps changing html code instead of acting on the database.
You have to read the file content and load it into a form in a textarea or WYSIWYG and after submitting the form, put the changed data back into the file. The codes for loading and saving data, depends on programming language. check the documentation for opening and saving the file in PHP here.
http://php.net/manual/en/function.file-put-contents.php

Orchard - access a content type through different URLs so they use different views

I'm trying to create a CSS documentation library in Orchard. I want to save a description, CSS snippet and HTML snippet against each content type. The first view would show the description and CSS and HTML code written out. The second view would show a preview of what the CSS and HTML look like rendered.
cssdocumentation.com/content/item1
cssdocumentation.com/content/item1/live-preview
I've created the content type and the first view. But I'm not sure how to create the second view. I can see if I can create the alternative URL I can use the Url Alternates module to create an overriding .cshtml
To create an alternative URL I've looked at the autoroute module but this only allows you to adapt a single URL (unless I'm missing something?) and I've looked at Alias UI but this forces me to manually create an alternative URL everytime I create a content item.
Is this possible in Orchard without writting too much C#? (I'm a frontend developer so I only dabble in the behind the scenes stuff)
Thanks for any help
Best solution is to do this within your own module. But as a secondary option instead of having a second page, combine this content with your first page and hide it with CSS. When the user clicks a button to navigate to the next step render the CSS/HTML result on the same page. You can do this in many ways, here are a few ideas:
Render the CSS/HTML result out straight away on the same page but hide it. Show it when the user clicks a button
using jQuery to render the result on the client side. More dynamic if you allow editing of the HTML and CSS.
Redirecting the user to the same page with specific url parameters which you can pick up in your alternate to modify the output.

How can I specify a background image for a content query Webpart in SharePoint 2010?

How can I style the background of a content query webpart in SharePoint 2010?
I have been having a look around, and can't seem to figure it out. I am able to edit the individual item styles using the ItemStyle.xsl file in SharePoint designer, but I need a background image on the container.
I have referenced the class that is generated by SharePoint - 'WebPartWPQ4' - in CSS, and made it work that way, but that changes the styles for all web parts in the system. (This also feels like a bit of a hack)
Any help would be greatly appreciated.
It is totally okay that you try to override custom styles in your css (although 'WebPartWPQ4' is not the best choice). However, to get what you need, just ensure that the web part you want to style has some wrapper around it and change selector in your css to .wrapper > .WebPartWPQ4 so that only this instance of the web part gets styled.
The way I have solved this is to wrap the webpart zone in a div in the .aspx page file.
You can then reference this div in a css file.

How to include custom CSS or Javascript on a Content Item in Orchard

Sometimes I want to add some custom CSS or Javascript to a page but the HTML editor doesn't handle this gracefully, even when using text dialog.
I could use an alternate view but then I have to upload the view file to my host every edit.
Any ideas?
Ok, I found a module (Vandelay.Classy) that does exactly this.
http://orchardproject.net/gallery/List/Modules/Orchard.Module.Vandelay.Classy

Where can I find discussion board newform.aspx page to modify?

I have to modify text in discussion board new post page. Now it is showing "Items on this list require content approval. Your submission will not appear in public views until approved by someone with proper rights. More information on content approval."
I have to append some text to this message. I am trying to find discussion board newform.aspx page to modify. Please let me know where can I get that?
Assuming your discussion list is called "Public Discussion" at a site called "http://yoursite"
Connect to the site (http://yoursite) with sharepoint designer
Go to All Files -> Lists -> Public Discussion -> NewForm.aspx
Edit file
Look for <asp:Content ContentPlaceHolderId="PlaceHolderMain" runat="server">
Add content as needed
Save file, it will warn you that you are about to save a customised layout.
The message you describe is injected by sharepoint's content approval framework. To custom the messsage, you will most likely need to use javascript to find the message box and change the text.
On my site the html xpath to the node is something like this:
//span[#id='part1']/table/tbody/tr/td[2]
On the file system it will be here:
$sphome / "Name of your discussion board" (this will be a folder) / Forms / newform.aspx
There is a similar question asked here. It describes custom template controls handle the display of this content.
There is also a link here that describes a solution to do this using css. This would allow you to hide the OOB text and then have your own content displayed instead. However, there is some question of it working on broswers other than IE so include this in your testing.

Resources