I would like to make a system where my users can customize the look and feel of my webapp.
My goal is to give them an HTML editor and some predefined tags like [BUYBUTTON] and [PRODUCTLIST] they can use.
These tags should be replaced with actual ASCX controls so that they not only display the HTML output, but have any code-behind functionality.
A generic find and replace of text/html is easy, I can't wrap my head around how to make the controls embed into the template.
Can someone give me a little push in the right direction here? I will be doing this within a DNN module if it matters.
I would look at how DNN's XML Skin parser works.
I wasn't able to find any good tutorials but here is a link so you at least know what Im talking about.
Cheers.
I would suggest to look at the source code of announcement module, which is doing almost same thing that you want to do.
Only difference here is, announcement module is storing the template in settings, so you can have different layout templates for different modules on same page/portal.
Hope this will help you, happy coding
Related
I'm trying to implement a drag-n-drop fileupload to my website and found a piece of java called Dropzone.js, it holds everything i need . . . i just have no idea of how to use it!
So far I've been programming only in razor ASP.NET (c#) / HTML / CSS, but so far no javascript / jquery.
It's razor webpages, so no mvc.
Due to my current lack of knowledge in java, i apologize in advance but i'm stuck !!
What i'd like to know is:
I'f i've understood things correct, i should not modify Dropzone.js directly, i should use it as a library and integrate it in my other scripts, e.g. in another .js file. Correct?
Any help in this will be greatly appreciated.
Kind regards,
Daniel A. Rischel
.. Edited as per requested.
Well, you're wrong somewhat. It might not be related to the question but please note these scripts are JavaScript and
java != javascript
Got the point? :) Please try to note this in future. Also, Java code cannot be added to these server-side language, because java itself is a language. You can use JavaScript or its library (jQuery) and create some plugins.
I'f i've understood things correct, i should not modify Dropzone.js directly, i should use it as a library and integrate it in my other scripts, e.g. in another .js file. Correct?
True, you need to link this plugin dropzone.js to the site using
<script href="/link/to/dropzone.js"></script>
Then you'll use this script on the whole of the page where it is linked.
And you should never edit the source code of a plugin, untill or unless you know what you're doing. Because you might mess up with the code.
I'd really like to see some source code examples of what a single file drag-n-drop fileupload form would look like. I've googled extensively but not found something i can use yet.
Did you try to read their documentations? They have a good code explaination on the default (main) page of their website too. And really it depends on just the way you style it. Its just a plugin, you will need to add your own CSS code to style the form. This plugin won't style the form for you, all it will do is to handle the upload events and get back with the result. So, which means that form creation and elements is all upto you!
If there is a dummies tutorial in making this work, i'd really like to be pointed in the right direction!
There is no perfect answer to provide you with, however I will provide you with some basics
http://www.javascriptoo.com/dropzone-js
https://stackoverflow.com/questions/tagged/dropzone.js?sort=newest&pageSize=15 (stackoverflow tag)
In the second link, you can go and see what are the very basic of the issues that are handled with what code. Easy methods will be hanlded by you! You'll need some guidance in just the hard jobs. Good luck for that!
My suggestion for you is to first undertand and learn jQuery, then learn how to make ajax calls. After that you'll know how to create and handle the events. The basic code will be
$('input[type=file]').change(function () { // change in value
// send the file via ajax
}
http://jquery.com
This method will be best as you will know what code you're using and what it will do. Using plugin is easy method then this one. But my preference is with the second one; creating your own plugin.
I am facing a pesky problem at the moment on a large website with multiple languages. On arrival at the website, it detects what country you are from and prompts you to confirm this. On confirmation, it swaps out the pages languages from the DB and displays the relevant language. This is done using jQuery. Now the problem is that Arabic reads rtl, so I need to either:
-- swap out the stylesheets for "rtl" version
or
-- change the HTML tag and include a "dir='rtl'" arrtribute
Now, I have tried both of these, with failures on both. When I view the page source, it still shows the old Css file or HTML tag without the "dir" attribute. Correct me if I'm wrong but I believe this to be due to the DOM not registering the new changes, as they have happened asynchronously via jQuery after the DOM has been instantiated.
After all that blah blah and tldr;
Is there not an easier way to swap out the text direction dynamically? If this is a DOM issue, how can I reload the DOM after the asynchronous callback?
I have been at this issue for hours now and have had very little luck on the interwebz.
Any and all help is welcome and greatly appreciated.
Kind Regards,
William Francis
EDIT:
After much investigation I found that the only way to truly work the Arabic way is with a post-back. Once the language has been selected you do a postback, then its just a simple process of changing the Stylesheet HREF attribute from code behind. There doesn't seem to be any form of JavaScript or jQuery that can change it without a post-back and still reflect the new Stylesheet. NOTE: you need to set the Stylesheet HREF on each post-back, i.e. through a master page. The Stylsheet changes do not persist across pages.
Here's a website that helped greatly and explains a whole lot on Stylesheet changes using JavaScript. sadly, it didn't work for me.
http://www.alistapart.com/articles/alternate/
There could be several things going on. I found this page to be very helpful when I was dealing with a similar thing, so I highly recommend it:
http://www.w3.org/International/tutorials/bidi-xhtml/
Also, if you aren't already doing so, use a tool like Firebug to examine the generated DOM after your AJAX has run to be sure you are seeing the altered state of the DOM and not the initial source of the page. It is possible to change the dir dynamically--you can use Firebug to add a new attribute to the HTML tag of this very page (set dir="rtl") to see it change dynamically. It could be some other element is overriding the direction, it could be that the AJAX changes aren't loading correctly, or other things. If you can post more of your code it would be helpful to give a better answer, but I hope this will help.
I am fairly new to asp.net so this may seem like a stupid question, but:
I am attempting to modify a pre-exsiting help menu in a web-app.
In this menu the previous developer, just used three literals seperated by paragraphs and a button linking to a 100 page manual. (i know doesn't seem to be much help, hence why i was planning to update and fix this)
What i had in mind was setting something up like a menu that would link to the different section of the page when the title is clicked.
So something along these lines:
<h1>Menu Contents</h1>
<ol>
<li>section1</li>
<li>section2</li>
<li>etc</li>
</ol>
After the contents section i would have the first section with it's details.
What i am wondering is why would i use asp-literals over just sticking to html?
So basically i would like to know what are the benefits or reasons for using asp literals and i guess when is it that i should use them?
I've attempted to find the solution to this on my own, but the only related matters i have been able to find have to deal with people arguing whether literals or labels are the best option so it's not entirely helpful.
Any help or suggestions are greatly appreciated.
Thanks.
You generally use literals if you want to be able to control the text you display programmatically. Say your page has a way to edit the section titles of your manual, for instance. Or say your manual is in multiple languages and you want the user to be able to set her language and see the section titles displayed in that language.
In your case, by what you're saying, I infer none of this applies and your manual is quite static. In that case I would stick to simple HTML.
Maybe it's been done that way so it would allow the links to be built dynamically, something like:
litMenuItem1.Text = "section1";
thus giving full control over the output? There are better ways to do that however.
Sorry about having 3 questions in one but they are closely related and should be simple for someone familiar.
I'm used to coding Java/Obj C/PHP and am finding trying to modify a template somewhat annoying partly because it doesn't make sense but mostly I can't find resources.
I am editing a master template and have gotten the basics but some things still allude me.
With the ContentPlaceHolders, is there a way to use it more than once? Someone posted some code about how you can do this but it said I couldn't use code here.
Is there a way to modify these ContentPlaceHolders without using Sharepoint designer?
I thought using the SharePoint: tag would be a possible way around this, but I can't find any docos on the possible tags and what they do and where to use them.
Thanks for any help.
A ContentPlaceHolder in a master page only maps to one Content section in a page/page layout.
Yes, you can modify the contents of ContentPlaceHolder using code, building a control tree.
The SharePoint tag prefix is used to signify a different control namespace, but there is no sharepoint:placeholder
Maybe if you explain what you are trying to do, we might be able to advise you the best way.
Is it possible to allow a user to customize sections of our website to match their look and feel? For example, to modify logos and CSS, possibly pointing back to their site for the actual content. Ideally I would also like a third-party (ASP.NET) tool to manage this, rather than coding a hack myself.
Edited: I want a solution where a customer can just use a menu to modify the attributes they want, so that there is no need for me to interact with the customer at all.
What you want is a CMS (Content Management System), there are lots out there. Just find one that suits you.
I hear Sitefinity is good.