Web Parts in PHP
Moderator: General Moderators
-
fastfingertips
- Forum Contributor
- Posts: 242
- Joined: Sun Dec 28, 2003 1:40 am
- Contact:
Web Parts in PHP
Hello
Does anyone tried to develop applications using web parts (like in ASP.NET)? I'm interested to find out about this subject and also about the architectural solution that you've found.
Does anyone tried to develop applications using web parts (like in ASP.NET)? I'm interested to find out about this subject and also about the architectural solution that you've found.
-
fastfingertips
- Forum Contributor
- Posts: 242
- Joined: Sun Dec 28, 2003 1:40 am
- Contact:
-
fastfingertips
- Forum Contributor
- Posts: 242
- Joined: Sun Dec 28, 2003 1:40 am
- Contact:
- Maugrim_The_Reaper
- DevNet Master
- Posts: 2704
- Joined: Tue Nov 02, 2004 5:43 am
- Location: Ireland
Maybe if you described a specific scenario? When building application, adding modular pieces can be solved via a number of solutions depending on what the pieces are aimed at doing. For example, if I posted a article to a blog I might have a collection of modules/plugins to filter that article before saving it (maybe applying markup, escaping special characters, highlighting code syntax). The solution for this setup could differ from your particular case obviously.
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
-
fastfingertips
- Forum Contributor
- Posts: 242
- Joined: Sun Dec 28, 2003 1:40 am
- Contact:
The details
I will start my explanation with an example, i hope in this way i will be better understood.
In a shopping cart for example i have product page details where i present to the user the details of the product that he wants to buy it. In the bottom page i have something like "Related products". This module is independent from the rest of the page with only one exception: the products listed in that area are from the same category with the product for which i'm displaying the details.
So my problem is that i have a page catalog where i should record the modules and their order, but some modules must communicate with others.
All this functionality must be provided in a very flexible enviroment (i have different templates for each language etc).
In a shopping cart for example i have product page details where i present to the user the details of the product that he wants to buy it. In the bottom page i have something like "Related products". This module is independent from the rest of the page with only one exception: the products listed in that area are from the same category with the product for which i'm displaying the details.
So my problem is that i have a page catalog where i should record the modules and their order, but some modules must communicate with others.
All this functionality must be provided in a very flexible enviroment (i have different templates for each language etc).
Have you looked into something like smarty? It would let you create and reuse templates that you can include in other templates quite easily and pass arguments too.
Like this
Like this
Code: Select all
<p>
Here is my product detail:
{$product.name}<br />
{$product.price}<br />
{$product.description}<br />
</p>
<p>
Here are the related items:
{include file='tpl/related_items' category=$product.categoryID}
</p>
-
fastfingertips
- Forum Contributor
- Posts: 242
- Joined: Sun Dec 28, 2003 1:40 am
- Contact:
I think each of the modules you are describing are a view. It should be up to the controller to get the data and then create and call each view and pass the view the correct information, not a matter of the views (modules) talking to each other. I think getting your modules to talk to each other is not necessarily a good idea.
So in this case your controller would compile a list of products and category IDs from the model, create a partial view for the cart detail using the products, create a partial view for the related products by passing it the product IDs, then combine the two into one final view and paint it.
The language part should probably be encapsulated into the views. Each view as it renders itself would pull the language data either based on some sort of configuration setting or a language indicator passed to it by the controller.
So in this case your controller would compile a list of products and category IDs from the model, create a partial view for the cart detail using the products, create a partial view for the related products by passing it the product IDs, then combine the two into one final view and paint it.
The language part should probably be encapsulated into the views. Each view as it renders itself would pull the language data either based on some sort of configuration setting or a language indicator passed to it by the controller.
-
fastfingertips
- Forum Contributor
- Posts: 242
- Joined: Sun Dec 28, 2003 1:40 am
- Contact:
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: The details
It sounds like you want multiple Model/View pairs. Each Model would be initialized with a "category" value from the request/session/etc. All of these sub-Views would render into a main or outer View.fastfingertips wrote:In a shopping cart for example i have product page details where i present to the user the details of the product that he wants to buy it. In the bottom page i have something like "Related products". This module is independent from the rest of the page with only one exception: the products listed in that area are from the same category with the product for which i'm displaying the details.
So my problem is that i have a page catalog where i should record the modules and their order, but some modules must communicate with others.
A "flexible environment" is a very subjective term. Every programmer thinks their own or favorite framework is the most "flexible environment." Can you be specific about what "flexible environment" means to you?fastfingertips wrote:All this functionality must be provided in a very flexible enviroment (i have different templates for each language etc).
(#10850)
Is this what you are refering to?
http://msdn2.microsoft.com/en-us/library/hhy9ewf1.aspx
http://msdn2.microsoft.com/en-us/library/hhy9ewf1.aspx
ASP.NET Web Parts is an integrated set of controls for creating Web sites that enable end users to modify the content, appearance, and behavior of Web pages directly from a browser. The modifications can be applied to all users on the site or to individual users. When users modify pages and controls, the settings can be saved to retain a user's personal preferences across future browser sessions, a feature called personalization.