CodeCharge Studio
search Register Login  

Visual Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> ASP

 Dynamic Includes? Post HTML Template parsing?

Print topic Send  topic

Author Message
csierra

Posts: 123
Posted: 04/02/2011, 9:04 PM

Hello, I´m coming accross the need of defining dynamically several regions on a page, much like the functionality of modern CMS´s sytems, and then content on them; the first part is somewhat easy, the second is the task... example: have a page defined in DB tbPages, in wich each row is a web page, then this has a related table, one to many, with 'regions', 3 cols, 2 cols, 1 col, splash, facebook widget, etc. What I need to accomplish is to dynamically deploy data access specific modules (forms grids etc) specific to that instance of that CMS app; I´ve been trying with conv2ajax, jquery and so, to embeed iframes dynamically client side with a script generated server side onbeforeshow upon DB settings to that CMS page but it has many drawbacks, among others, if go ajax for example, no scripted content on regions, bogus results, etc; iframes, content must be overscripted /bloated to access parent.parent functions and so; my question would be

what would you use to accomplish this task?

Thanks again; I think soon I´´ll publish some of my work, you can check full codecharge created sites like http://www.smartvacations.com.mx among 20 others.



_________________
Yes! I Can!!!
View profile  Send private message
Waspman

Posts: 948
Posted: 04/04/2011, 1:24 AM

I do this with a more template based approach. My CMS has a base page made up of 15 positions. Each is an included container page. The user adds a page to their site and selects which positions they want for the page, 123 or all of them. When the page is created they can then add content for each of the positions. The holding page, and there can be more than one, calls the position based content in relation to variables in the url. You can see it here: www.aemfutures.com

If you want the site to be more than a one page site and the site above is, you can include or exclude positions specifically.
_________________
http://www.waspmedia.co.uk
View profile  Send private message
csierra

Posts: 123
Posted: 04/04/2011, 8:39 AM

Hey thanks for your reply, Waspman; I like the way you had implemented the web 2.0 style on that site.

Regarding dynamic includes, that has not been a problem in PHP, you can do an include within a running script, I cannot do that with ASP.

The closest i've came to is to use a custom convention for HTML, and store what was desing by the final user, e.g. 1 col, 2 cols, 3 cols, fb widget, spash, etc using something like

<div class "content">
|| {_splash}
<div>

And then, parse that db stored html blocks, and execute a common routine using server side "MSXML2.ServerXMLHTTP" calls, wich is basically AJAX / AJAH calls for an independant (encapsulated) asp file containing the module; but server side and oh oh!! Microsoft does not recommend to use this technology for calls on the same server and / or virtual file because it consumes another threard?

I'm stuck with so little options, I'll have to make a bloated page full of regions and then move the content from divs styled to display: none into the proper location within the page, using jquery client side.


_________________
Yes! I Can!!!
View profile  Send private message
Waspman

Posts: 948
Posted: 04/04/2011, 11:35 AM

Sounds very complicated?

Why?

Create the page with includes in CCS (you could even control that with CCS) then show content for those regions based on its relationship to the master page.

simples:)

You can have my project if you want?

err it's PHP:(
_________________
http://www.waspmedia.co.uk
View profile  Send private message
csierra

Posts: 123
Posted: 04/04/2011, 12:51 PM

You can see and take a look

http://travelrewards.com.mx/layout_01.asp?nid=75
http://travelrewards.com.mx/layout_02.asp?nid=75
http://travelrewards.com.mx/layout_03.asp?nid=75
http://travelrewards.com.mx/layout_04.asp?nid=75
http://travelrewards.com.mx/layout_05.asp?nid=75
http://travelrewards.com.mx/layout_06.asp?nid=75
http://travelrewards.com.mx/layout_splash.asp?nid=70
http://travelrewards.com.mx/layout_plugin.asp?nid=75

This is important too...
http://travelrewards.com.mx/layout_plugin.asp?nid=130 wich uses a plugin (our development) that uses iframes that auotsize and uses ajax, all cross domains, so this so far are our
achievements, if you see, all pages look very alike, we need more flexibility; I�m annoyed ASP cannot event handle Server.Execute in a proper maneer, I need to find even a COM object to handle this to make a request and get the html output calling in the same server, same thread, a simple asp page with params on querystring!

You can see the framework reusability with these 2 different looks, same code.

http://travelrewards.com.mx/testing/gt/02.html
http://travelrewards.com.mx/testing/gt/01.html

Your opinions are wellcome!

_________________
Yes! I Can!!!
View profile  Send private message
csierra

Posts: 123
Posted: 04/04/2011, 1:09 PM

There where errors in some files regarding urls

you can see cross domains using ajax and autosizing to fit iframes between travelrewards.com.mx and travel-edge.net, you can look for hotels and browse and ajaxed resultset grid not using cheesy prototype update panel, this uses jquery entirely, much lightweight and precise.

http://travelrewards.com.mx/layout_plugin.asp?nid=130

Please note all of the abobe content can be created and edited via a control panel without a single line of code for the end user. Your opinion is valuable for us.

Thank you
_________________
Yes! I Can!!!
View profile  Send private message
Waspman

Posts: 948
Posted: 04/04/2011, 1:13 PM

So you want different page layouts in your site(s)

Here's the controls of my CMS

1. Add a page -

http://www.waspmedia.co.uk/p1.gif


2.Select new page and add content to one of the assigned positions

http://waspmedia.co.uk/p2.gif


3.Select position

http://waspmedia.co.uk/p3.gif


4.Add content and override CSS with inline CSS if required

http://waspmedia.co.uk/p4.gif


The guy who's using the AEM has endless possibilities from the master CSS to the block positions and the inline CSS.

The "Block" approach allows you to create custom elements to be included in any of the positions. We started the "Block" approach to a CCS CMS a couple of years ago, but it never got off the ground.


_________________
http://www.waspmedia.co.uk
View profile  Send private message
csierra

Posts: 123
Posted: 04/04/2011, 1:16 PM

Quote Waspman:
Sounds very complicated?

Why?

Create the page with includes in CCS (you could even control that with CCS) then show content for those regions based on its relationship to the master page.

simples:)

You can have my project if you want?

err it's PHP:(

It would be valuable to have it, yes, that way I could grab some ideas?
You may email it to mesierracebrian@gmail.com and if you want I can share some of my work if you find it interesting for your purposes.
_________________
Yes! I Can!!!
View profile  Send private message
Waspman

Posts: 948
Posted: 04/04/2011, 1:20 PM

I'll sort it out and send you the file. Will you be OK with the MySQL dump?
_________________
http://www.waspmedia.co.uk
View profile  Send private message
csierra

Posts: 123
Posted: 04/04/2011, 1:23 PM

I see... that is kind of a good sollution (partial) because it does not allows us to make, for instance, alternate repeating blocks, let´s say, we want 3 simple html blocks in different regions of the page, I can only insert one includable per page, not 3; so that is the goal...

Nice backend panel, like it.
_________________
Yes! I Can!!!
View profile  Send private message
Waspman

Posts: 948
Posted: 04/04/2011, 1:28 PM

No. You can place "unlimited" includes(records) per position with the system. You can just keep adding content to the page at different positions. The image just show the process happening once.

The include simply recalls a record or records assigned to that position on that page containing HTML content.

So position 4 could be a record containing text. A record containing an image or a record containing both. And that could be repeated as often as you like at position 4. Then you can do the same for other positions. You can also make the some or all content(records) repeat throughout the site.

So multiple content at any position see...

http://www.waspmedia.co.uk/p5.gif
_________________
http://www.waspmedia.co.uk
View profile  Send private message
csierra

Posts: 123
Posted: 04/04/2011, 2:50 PM

Hey Waspman, thanks, dont complicate yourselve; if you can only send the php files in wich the css / html modifies upon config, I´ll have a good idea on how does this work; perhaps the project without DB could be ok!

Thanks
_________________
Yes! I Can!!!
View profile  Send private message
csierra

Posts: 123
Posted: 04/05/2011, 12:49 AM

Hey Waspman, I did not receive anything yet; I am in great need to implement a solution like the one you have. Browsing for alternate solutions; wich is in fact, not for now, found this, find it very very interesting! take a look!

http://jaxer.org/

This looks very promising for purposes like the one I would like to achieve; imagine manipulating entire dom easily server side and the just in one http request throw the entire html ready to go!

Look forward to receive the files!

Thank you very much for you help
_________________
Yes! I Can!!!
View profile  Send private message
TheunisP

Posts: 342
Posted: 04/05/2011, 1:28 AM

I was wondering if this would help, we had/have the same requirement for band websites so I started with a page I bookmarked:

http://designshack.co.uk/articles/layouts/10-rock-solid...layout-examples

I then created empty hrml templates of these and a couple of other designs and called it template1.html, template2.html etc.

In the template we have a similar solution as waspman each block element has a name e.g. b1, b2, b3 etc.

This is where I am now: the user creates a page, selects a template - then in another screen he builds page blocks e.g. content section - we then do a assoc relation e.g. b1 = your intro b2=contact details

the css is the power part I think, say we have b1 in the template we would have it as a double div
<div class="b1"><div class="b1inner">

in the css the user can now select a css group either the predefined blocks or from their own names, we present them with a css selector and they can fill in the vlaue or pick it.

We then write the CSS out as a group by sql select first the element name, selector and value.

To get the page - we drop a PHP or ASP that calls a remote page builder via XMLhttp or fopen. The page builder start by loading the temlate from the template1.html file - it then start looking for blocks inside the template we used [b1] etc as plaseholders if the block is found we do a sql call to get the blocks content and replaces it into the template.

At the end we write it out, and the calling page writes it out via the xmlhttp or fopen result. This is great since we don't have anycode on the clients server except the caller and if they discontinue the service we just disconnect their info and the page builder wont display anything or a suspension page if need be.

View profile  Send private message
Waspman

Posts: 948
Posted: 04/05/2011, 4:18 AM

Hey csierra,

I sent the files already via link in a pm?

Sent early this morning. Let me know your email and I'll send them direct...
_________________
http://www.waspmedia.co.uk
View profile  Send private message
Waspman

Posts: 948
Posted: 04/05/2011, 4:27 AM

Jaxer (and Aptana) - yeah I tried these before, but it's far too advanced for me:) I like the more flexible (simple) approach that I get with CCS.

Plus I don't get the server side DOM (i.e. everything on your web page) manipulation thing? isn't DOM client side?
_________________
http://www.waspmedia.co.uk
View profile  Send private message
csierra

Posts: 123
Posted: 04/05/2011, 11:05 AM

Quote Waspman:
Jaxer (and Aptana) - yeah I tried these before, but it's far too advanced for me:) I like the more flexible (simple) approach that I get with CCS.

Plus I don't get the server side DOM (i.e. everything on your web page) manipulation thing? isn't DOM client side?

The power of this is rather than traversing an often very lenghty string, and doing it with string manipulation functions or regular expressions, you could use $(#block_1).innerHTML = fopen(yourcontentblock.asp?vars...) wich is much faster.

By the help I'm receiving by you and other members here in this forum, I can see that the approach is to leave the content origin quiet (let's say the include or the recordset result) and wrap it conditionally with html blocks, wich is actually working for you, however, I think this is somewhat contrary to the concept of templated html to separate design from data, that is what codecharge uses; right? I'm not getting married with any software production dogma here you know; but using ASP often, manipulating HTML blocks in VBS is messy, bogus-prone and umcomfortable.

I've just received your files, I am very thankful for your help; let me dive into them, and try to understand exactly how do you do the repeating sections; how does that is achieved. I'll soon be over you with all of my questions... =D


_________________
Yes! I Can!!!
View profile  Send private message
csierra

Posts: 123
Posted: 04/05/2011, 11:36 AM

Quote TheunisP:
I was wondering if this would help, we had/have the same requirement for band websites so I started with a page I bookmarked:

http://designshack.co.uk/articles/layouts/10-rock-solid...layout-examples

I then created empty hrml templates of these and a couple of other designs and called it template1.html, template2.html etc.

In the template we have a similar solution as waspman each block element has a name e.g. b1, b2, b3 etc.

This is where I am now: the user creates a page, selects a template - then in another screen he builds page blocks e.g. content section - we then do a assoc relation e.g. b1 = your intro b2=contact details

the css is the power part I think, say we have b1 in the template we would have it as a double div
<div class="b1"><div class="b1inner">

in the css the user can now select a css group either the predefined blocks or from their own names, we present them with a css selector and they can fill in the vlaue or pick it.

We then write the CSS out as a group by sql select first the element name, selector and value.

To get the page - we drop a PHP or ASP that calls a remote page builder via XMLhttp or fopen. The page builder start by loading the temlate from the template1.html file - it then start looking for blocks inside the template we used [b1] etc as plaseholders if the block is found we do a sql call to get the blocks content and replaces it into the template.

At the end we write it out, and the calling page writes it out via the xmlhttp or fopen result. This is great since we don't have anycode on the clients server except the caller and if they discontinue the service we just disconnect their info and the page builder wont display anything or a suspension page if need be.



Hey Thenius, thanks for your reply! I am very interested in this approach as I think is the most efficient and flexible way to achieve what we specifically need; can you please explain me further how did you make ASP / IIS not to hang and cause a timeout when using xmlhttp requests? do you request on the same server? or is that you have 2 systems; one that dispatches data and the other 'assemblies' the final html fetching data form the first one?

Thank you very much. a Question, I assume fopen is a PHP function, (I am very well versed in ASP, but not in PHP) If so, does it have the same limitations or is it possible to execute requests for the same server, file, virtual file etc?


_________________
Yes! I Can!!!
View profile  Send private message
csierra

Posts: 123
Posted: 04/05/2011, 9:42 PM

Quote Waspman:
So you want different page layouts in your site(s)

Here's the controls of my CMS

1. Add a page -

http://www.waspmedia.co.uk/p1.gif


2.Select new page and add content to one of the assigned positions

http://waspmedia.co.uk/p2.gif


3.Select position

http://waspmedia.co.uk/p3.gif


4.Add content and override CSS with inline CSS if required

http://waspmedia.co.uk/p4.gif


The guy who's using the AEM has endless possibilities from the master CSS to the block positions and the inline CSS.

The "Block" approach allows you to create custom elements to be included in any of the positions. We started the "Block" approach to a CCS CMS a couple of years ago, but it never got off the ground.



Hey Waspman, after browsing the inner workings of your solution, I have the first impressions; I think it is a good approach however, it would not work for what we want; the difference resides on what are we willing to use as content; we have about 12 different 'widgets' or 'accesories', wich are, let´s say, an instant grid wich is a recordset runtime generated from a range from a sheet inside an excel file, we have an image gallery, a documents list, a poll module, a splash module, a simple HTML content block, a facebook and tweeter integration widgets, a custom data block, a forum / opinion board, among others; what you use always displays the same record structure from a table, therefore the includable pN, wich is basically a grid that iterates thru rows, is possible. The approcah of having a container HTML 'skeleton' with divs with id='Block1' and inside of this div or span id=p1, p2 pN is something we are gonna try, and after that, try to use a script file to work as interface with something like getcontent(node_Id=X) this script should execute custom page per module, one for the instant grid, another for the image gallery and so on; this is where we are stuck, the last step before page output to the client´s browser would be to locate this content gathered by getcontent inside each block´s position correctly; perhaps using regular expressions and a huge buffer for the final html. The other chance would be to call those files on the client side, with jquery ajax or similar. What do you think could be a solution for an heterogenous data per block?

Thanks again
_________________
Yes! I Can!!!
View profile  Send private message
Waspman

Posts: 948
Posted: 04/06/2011, 12:15 AM

heterogenous data - WOW!

If you're using phrases like that I'm out of here:)

Nice and simple for me I'm afraid.

The concept with the CCS CMS was to include CCS in the building process and not for it to be a stand alone CMS. Therefor special components like forums and polls etc. would be integrated in the build with separate custom pages. You'll see something like this in my project.

If I was to approach this I would add a component type selector after choosing the position (or the other way round) and probably use jquery (since I'm now doing this with other projects) to call the relevant component.

Good luck with your problem.

_________________
http://www.waspmedia.co.uk
View profile  Send private message
csierra

Posts: 123
Posted: 04/06/2011, 10:14 AM

Thanks again for your kind help, you actually helped me out a lot with the blocks concept; it will be part of the tailored sollution. Regarding those fancy words... well english is my second langage; heterogenous... jeje... I meant different data, different structure, cannot be abstracted under a recordset output.

Thanks again
_________________
Yes! I Can!!!
View profile  Send private message
solesz

Posts: 137
Posted: 04/06/2011, 12:50 PM

Hi Waspman,

I am building an Intranet CMS for my company.
May I ask you to send your project to me, to learn some tricks?

You can PM me, or you can send it directly to solesz[at]hotmail.com

Thanks,

Peter
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

PHP Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.