How to define custom wicket tag - wicket

I could not find a wicket tag like wicket:include? Can anyone suggest me anything? I want to include/inject raw source into html files? If there is no such utility, any suggestions to develop it?
update
i am looking for sth like jsp:include. this inclusion is expected to be handled on the server side.

To do this, you'll need to implement your own IComponentResolver.
This blog article shows an example somewhat resembling what you're after.

Is it raw markup that you want to include, or Wicket content?
If it's raw markup, even a simple Label can do that for you. If you call setEscapeModelStrings( false), the string value of the model will be copied straight in the markup. (Watch out for potential XSS attacks though.)
"Including" Wicket markup is done via Panels (or occasionally Fragments)
Update: If you add more detail about the actual problem you need to solve, there's a good chance that we can find a more "wickety" solution, after all, JSP and Wicket are two different worlds and the mindset of one doesn't work very well in the other.

Related

Which template system should I use in Typo3?

Up to now, I used to use template auto-parser. I like the fact I can modify any element of the template using typoscript, without altering the initial HTML file. I also like the fact that I can render the html template directly in a web browser, filling it with dummy elements to see examples of menus and content elements. Finally, with the new backend templates, i now can place content elements anywhere on a grid, in a way that mimics the real aspect of the website.
I know there is also TemplaVoila. I never took the time to learn it. My feeling is that it is less compatible with some extensions, but maybe I am wrong.
Now, there is fluid, that will be used in the next version of Typo3. While it is clear that it is better using it that using template markers, I don't really understand why I should be better using Fluid than using template auto-parser or TemplaVoila. What I dislike is the fact it requires to modify the html template with special tags, meaning that either the web designer has to know Fluid, or the Typo3 integrator has to modify templates from the designer each time a modification is performed.
My question is: should I migrate form template auto-parser to Fluid for my website template? What are the benefits of using Fluid? Why should it be better? What template system should I use with Typo3?
As long as TypoScript does not support objects, the benefits of FLUIDTEMPLATE over template auto-parser are only a few. So there is no need to migrate.
But IMHO there are some arguments to switch to fluid:
more and more extensions will use fluid, so it will help you to learn fluid
you can use an ide with code-completion for fluid (it is just XML!)
fluid is really powerfull, you can have f.e. if statements which checks for empty content
some day TypoScript will support objects as well
But for extension developement, it is totally different. In an Extension, i would allways prefere using FLUID. You do not have to deal with template things inside your extension anymore. Just pass the data to fluid and things which concern the view will be done in your template.
Whever you choose, it should be something based on Fluid - this will allow you to be extremely versatile and it makes the implementation less important than the template, which is quite good.
I myself am the creator of the "Fluid Powered TYPO3" framework (formerly known as FED) and would of course recommend that you take a look at what this framework can do for you - it's capable of great things, not the least of which is saving you a lot of time while at the same time allowing you to create even more consistent templating for pages and content - and even backend modules.
And we're always happy to help new users. We are currently in the process of improving our documentation, but you can already find many fully up-to-date guides on our Github page - https://github.com/FluidTYPO3 - the repository called "documentation" is the place we will store all the documentation.
You may want to have a look at http://fedext.net http://fluidtypo3.org - especially the "Tour of features" which tries to explain the point of Fluid Powered TYPO3 in as few words as possible. After that, the examples from the documentation will give you a much clearer picture of what Fluid Powered TYPO3 can do for you.
We focus on efficiency always - we've tried to do all the heavy lifting so that you really can just sit down and begin creating page templates. We took a lot of inspiration from TemplaVoila but there is no more re-mapping of content and things like this: when you change your templates, that change is immediately reflected, which makes it very nice to work with in iterations and do things like continuous delivery and -integration.
Hopefully this helps!
Cheers,
Claus aka. NamelessCoder
You could also argue, that adding special tags like
<f:section name="typo-content">
<div id="content">This is where the designer intended content to go</<div>
</f:section>
Could assist your designer while doing a redesign to know where you "mapped" your content elements to. This is neither the case with autoparser nor with TemplaVoila. So if the designer moves stuff around you probably get your templates back and they still work without any modifications.

Why do we use HTML helper in ASP.NET MVC?

Are there any good thing, best practice or profit we have after using the HTML helper in an ASP.NET MVC project?
When I am trying to use them I found that I lose the speed I have with HTML and many difficulties I have whenever I use an HTML helper.
Other [non-techie] persons can't understand what I write using Helper if I want to show them or they want to do something they need to spent more time on, even if they have working knowledge of HTML.
If I use an HTML helper I lose the speed. When I use HTML I just type and of course I am not aware of it. But using helper, it is hard to understand.
What thing do we get when I use HTML helper? I think it is nothing I get because I lose the speeed. Others can't understand what I do using helper and can't customize the code if they want.
Why do we use HTML helpers?
You use HTML helpers to encapsulate some small HTML fragments which are repeated all over your pages. And to avoid writing those HTML snippets all over again you use helpers.
They are very useful, especially when dealing with things like URLs because instead of hardcoding your links helpers take advantage of routing the definition on your server and by simply changing those routes the whole site URLs' change without ever touching any single HTML page.
Another scenario where HTML helpers are useful is for generating form input fields. In this case they automatically could handle values when posting back and show associated validation messages. Can you imagine the spaghetti code you would have to write in your views if there weren't HTML helpers?
The biggest advantage I find is with the editor and display templates.
If your editor for a field is more than just a simple input box, you can put that into a template and replace the several tags with a call to
<%:Html.EditorFor(m=>m.Property)%>
This means that your page is a lot easier to edit as you aren't wading through a lot of fluff HTML to find what you want.

Sanitizing title URLs in ExpressionEngine 1.6.x

I run a blog where the blog title is either an external link or an internal link to a longer piece similar to what you’ve seen on similar blogs. For some reason, ExpressionEngine (1.6.x) does nothing to sanitize such things as ampersands in the URLs provided.
I use Markdown in the body text, which seems to do a great job of sanitizing all URLs. Yet, ExpressionEngine’s own handling of the titles doesn’t cut it. I have tried formatting the “title URLs” in Markdown and failed miserable, and damn if I know what the hell it is in ExpressionEngine that prevents me from using it.
So the question boils down to what other ExpressionEngine 1.6.x users do and have done, or whether someone can come up with a MacGyver-esque solution. Because I’ve been stumped upwards of half a year.
The XML Encode Plugin for EE1 from Rick Ellis of EllisLab will convert your special characters to HTML entities.
The plugin was originally designed to convert reserved XML characters to HTML entities in the ExpressionEngine RSS templates, but should work for what you need.
To use the plugin, wrap your {title_link} custom field in between its tag pairs:
{exp:xml_encode}
{title_link}
{/exp:xml_encode}
This would result in:
http://www.google.com/search?q=nytimes&btnG=Google+Search
Being converting into:
http://www.google.com/search?q=nytimes&btnG=Google+Search
Other EE1 Plugins which offer more similar but advanced features are Cleaner by utilitEEs (Oliver Heine) or Low Replace by Lodewijk Schutte.

Suggestions for a very easy to edit CMS?

I need advice/suggestions.
At my place of work - we have a large data set.
We would like to server the data up as editable html pages.
(Its mostly lists of simple text)
We would like to add data, change it's order, update text etc...from the editable pages.
It has to have a pretty low bar for usability and WYSIWYG is a must.
The folks who will edit are not programmers by a long shot.
We are not sure Wiki will work.
It might have to do - but not sure.
Changes have to be tracked and written back into the DB
I am thinking some kind of open source CMS might work?
Wordpress, Joomla, Drupal - something that can get us up and running pretty quickly.
I really am open to suggestions - not sure where to begin on this one.
Thanks all
If you don't have someone available right now with expertise with a specific CMS, it will not be quick to set up at all. One good reason is that you'd have to import all of your existing data into whatever form the CMS supports: this is a task for someone who has done it before. On the other hand, if you can pull that off, some of the built in WYSIWYG editors are quite easy to use, with some systems you get versioning and author information for free etc. I'm speaking mostly with the eZ Publish CMS in mind, although it's probably true for other systems.
I would make a simple CMS site that uses the Ajax control toolkit HTML Editor and perform updates to the database on postback.
Here is the link to the Editor example
http://www.asp.net/ajax/ajaxcontroltoolkit/Samples/HTMLEditor/HTMLEditor.aspx
CMS Made Simple (http://www.cmsmadesimple.org) is very easy to set up and use. You do need to understand xhtml and javascript for the theme whacking, but once it's set up it has been trouble free. See my http://www.ConvinceProject.com as an example. It is MUCH easier to use than Drupal and appears to be more stable. I've had Drupal crash when installing security updates to modules, for example. It gives you full access to the header metatags, has fully integrated php and smarty tags, seems quite complete.
AFA importing, this is all mysql-based, although it can use others. If you have a web-whacking coder, pages can be 'scraped' and stuffed if it's more than cut and paste will do.
Lots of us can do it, it's not hard.
If I understand you correctly, it seems like you just need a web-based GUI for editing your DB. Honestly it would probably be faster to just roll your own in the language most familiar to you. There are many fine WYSIWYG editors out there that you can wrap around a text field, such as http://ckeditor.com/.
On the the other hand if you're hoping to solve this problem with DB skills and not do any web dev it may indeed be easier to find a simple CMS. ModX and SimpleCMS comes to mind. Joomla, Drupal and WP all come with so many out of the box features you'd have to strip out - look for something that starts fairly simple. Drupal in the right hands could do this, it has tools for importing/exporting to external DBs but the learning curve is pretty steep. Be aware that some CMSes do strange things with entry data...you may have to look for a text field inside a stored array (Drupal) instead of stored as a straight text field.

TinyMCE writes terrible HTML!

I've currently got TinyMCE incorporated into the backend editor of a simple blogging/page-editing app, but I'm extremely unhappy with the HTML code it creates. It does all sorts of messy things like:
Adding inline style information to span tags that you can't ever find to get rid of without editing the HTML directly.
Nesting tags in nonsense ways (e.g. <p><strong><p><span>some text</span></p><strong></p> just to make something bold.)
Adding empty <p> </p> lines where they don't belong and I'm not trying to create blank lines.
EDIT: I've looked at lists of the other editors out there (including on SO), but I want to know if people firsthand have had better luck getting clean code out of their wysiwyg editors.
Any recommendations for one that outputs better code behind the scenes?
How about a rather drastic alternative, and using a WYMIWYG (What You Mean is What You Get) editor rather that another WYSIWYG editor. That way the author is in full control of the schematic markup as well as the content he/she is entering.
Unfortunately I haven't found one that is as feature rich and usable as tinyMCE, but it seems to have come a long way - see http://www.wymeditor.org/demo/
Use HTML purifier before saving the content into the database.
HTML Purifier
I found JoomlaFCK to be a very good alternative to Tiny MCE.
Hope you like it.
bye
BTW I know it is an old thread but someone might use it. ;)