CodeIgniter Forums

Full Version: How to insert specific elements in common page content?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi there!

I have one question that I worry about and interested very long time

Imagine we have page content. As we know it usualy fills with texteditor like CKEDITOR

And what if I want to insert in some place in text that we paste with texteditor some special elements like custom gallery,

or some contact form or some google map, I mean that staff which not related with usual text


1) Divide page content into pieces and fills it separatly, then in page with unique design paste this parts in certain places and between them insert our specific elements

2)Create some sorts of placeholders in texteditor - [[gallery=1]], [[contact_form]],[[map=2]] and so on. And before render page look up through the text content, parse and replace with that staff we need

3)other options?

So what would be the best practices from your professional look? How u resolve this kind of situation?

Any replies? Sad
I think the resolution is not a one answer fits all situation. It all depends on what you are inserting, your type of users and your needs from a page perspective.

I have actually done both examples. I had on one site a tag {{gallery}} to insert a photo gallery.

On another site, a shop in this case, I split the text into 'above the images' and 'below the images'.

Both cause issues although the second one was the clearest approach. Users do not always appreciate the time and effort needed to make the first sample work well, and the flexibility it offers.

Either way is good. Personally I find the latter is the easiest to do by far.

A third approach I have recently tried, although believe me it has its issues too, is to give the users 'blocks'. Text block, gallery block, title block etc. Then they add however many of different types of blocks they want and order the blocks however they want. This is a very good solution IMHO and users love clicking and dragging the blocks around to organize the page.

I think, if I had to choose an approach for a future project, if my users needed the flexibility I would give them blocks again, but if they needed simplicity, I would give them 'above' and 'below' textareas. I would not do the the tags again as this means a learning curve and questions and support materials and support and all the problems associated with users.

Best wishes,

You have summed up why developing a flexible CMS for all conditions is almost impossible. Because as you add more features and flexibility it becomes a mountain of code to maintain. There is always a trade off between how specialized a template should be versus the time it takes to create and maintain that template. The guideline could be - how often does this content change? If its a complex layout - but the content only changes once a year - then its better to just code up the page and make the changes by hand once a year. Whereas for content that changes all the time - then if possible the template should match the page as closely as possible because that will make it easier for the people using it. the slippery slope is when you try to make one template that will work for a bunch of different conditions. Better to have 5 templates that do the job well, versus one template trying to do five very different things.
Yes, you are absolutely right. For instance a site I finished just a while ago had multiple vendors per quote, each quote having products from different vendors per line, each line with different vendors. Each quote was sent out built out of vendor pricing, depending on the quotes that came back. However, different vendors only supplied certain products, so choosing one quote from a vendor could mean that, given the overlap, different lines could have quotes rejected. So line 1 from vendor 1 and 2, if you decided on vendor 1, meant vendor 2's quote for line 3, say, was also rejected. Despite all the effort doing the multiple vendors for different lines for if they could be accepted or not etc etc in the end what does the customer actually do. One quote - one vendor. What a waste of good coding that was.

Am just glad I charged them a bloody fortune :-)

So for a CMS, you simply cannot cater for every eventuality. You just have to go with the 80:20 rule, 20% of your functionality will be used 80% of the time.

It would, in the case of a CMS, give you that added feature though of 'if you need it we can do it but it will cost you extra!'.

As another example, I built a company sales manager recently where a person could be linked to multiple companies, because that is what they said was 'essential'. Despite the headaches that caused (multiple relationships, multiple job titles, multiple contact details repeated for company and direct etc etc) how many of their records would you guess actually use multiple companies? So far, with over 3000 contacts added, absolutely none. yet despite me constantly explaining why it was unnecessary, they insisted it was an essential feature.

Any way, enough moaning by me about stupid customers, at least they paid for the burden :-)

Best wishes,

Very thank you both guys! Yes I have tried this options too and just need to be sure if I all doing right less or moreSmile

I dont know about usual CMS systems like Joomla or Wordpress, and I wonder how they do this, so thats why I asking here.

All this problem just because user (important that this is will be only ADMIN) must insert any specific staff(not plain HTML tags and text) in any place on the page.

For all this things I have created gallery list, google map list (cause insert google map in texteditor with custom markers unreal) and so on.

I wanted just to be sure that I am not crazy and folowing more or less in right directionSmile

Maybe you know about some already done solutions on the webwide or hear where this is all I could read to understand better, like best practices for this kind situation?

Anyway if not, its ok. I am very grateful for sharing you expirience and ideas and I already have a clue about this

Thanks again