I am new in cakephp. I have a module with name contact us in 1 of my project. This module need to show on almost all pages of the website. So my question is, for this common module can we create component or there is some other way to complete it? I read about the components for the site and found that components does not have own views. Please suggest me how can we do this?
Thank you
Cakephp Elements
Many applications have small blocks of presentation code that need to be repeated from page to page, sometimes in different places in the layout. CakePHP can help you repeat parts of your website that need to be reused. These reusable parts are called Elements. Ads, help boxes, navigational controls, extra menus, login forms, and callouts are often implemented in CakePHP as elements. An element is basically a mini-view that can be included in other views, in layouts, and even within other elements. Elements can be used to make a view more readable, placing the rendering of repeating elements in its own file. They can also help you re-use content fragments in your application.
Elements live in the /app/View/Elements/ folder, and have the .ctp filename extension. They are output using the element method of the view:
echo $this->element('helpbox');
For more details check out Views — CakePHP Cookbook 2.x documentation
Related
I work on site admin application and use marionette. And my problem is - how to organize views and applications for next requirements. Thanks for any help!
There are main menu on header - Users management, Evenets, General settings
And when user clicked to Users management On main region must shows additional menu with
Users Groups Permissions items and by default list of users (first tab is active).
Each item on click should shows coresponding view with list of entities.
And my question is how to organize applications, views and interaction between them?
Is sub menu part of users list view or it independent view? Which type of marionette view it must be?
Sounds a lot like typical web page where it would be much easier to just render HTML on the backend and not build a web-application.
As for structure, there is no one correct way, but I found these couple example projects as decent start to evaluate the best structure:
https://github.com/derickbailey/bbclonemail
https://github.com/Foxandxss/bbclonemail
https://github.com/brian-mann/sc02-loading-views
They all use slightly different structure and coupling. You have to decide yourself which one is best suited for your case.
In your case I guess main application with main region where you show different sub-applications based on user selection (tabs). For specific interaction patterns look at the examples. Try to decouple everything, don't pass around references instead emit and listen to events.
I've built and work with couple bigger web applications and I recommend to no go that path unless there is a reason to do that. Admin interface sounds like something you can "quickly" setup using existing frameworks like django-admin, flask-admin, Rails scaffolding, express-admin, well you get the idea. Then again I don't know anything about the project.
I am developing a Drupal 7 site with a home page that consists of 5 regions. Each region will need to be editable within the Drupal admin system. Each region at a minimum will need to have an image upload and a text/body field. There may be other additional fields for certain regions. In other words not all of these regions will need the exact same fields.
I am not sure what the best way to set this up in Drupal is. I looked at Blocks but they don't have the ability to customize the fields. And I need my image field to be separate because it will be used as a background image for the region, not displayed inline.
I considered creating a custom content type but I wouldn't want the content editors to be able to create multiple nodes for a given region which would likely cause confusion.
I did see a module Node Limit that seems to limit the number of nodes that can exist for a user or content type but it is still listed as an alpha module.
What have you done to deal with a similar situation?
It sounds like creating a custom block would serve you well. It's very easy to do, you can add your own form/fields with hook_block_configure() and hook_block_save(). Here's one of my module files that includes custom block with a config form.
You could also possible use the Display Suite module to add fields into a region, as explained here.
Display Suite is good for configuring a node's fields in a presentation layer.
But your problem could be on the top of that... Maybe your problem is content building, and one of your most powerfull & flexible options is the paragraphs module.
With paragraphs you must create a content type, with the paragraphs bundles inside of it as a field, then create a page and set it to be your front page. Then customize these node types presentation with Display Suite as you need.
I know a content type for a page sounds too much, but depending on your situation this could be your best choice.
Paragraphs module and the Display Suite Module are very powerful together when you need powerful content creation and advanced theming.
If you have any doubt just ask.
Hope that helps.
I want to know about Drupal 7 module "Panels", and to know how to work on it, how it is useful in creating panes and customising it.
like the right top side in the below website. http://www.newsclick.in.
I would recommend you to look at this screencast:
http://dev.nodeone.se/node/770
Not just Panels but also how it works with page manager and views.
Kristoffer is correct. Looking at the right side of the website you linked, a lot of the functionality is found in views. You might use panels to handle appearance and views to address content. They work together very well. If your new to Drupal, I suggest you focus on the functionality and deal with the appearance after. Nodeone also has an excellent video series on Views called "Taming the Beast" which you will want to study before attempting to link views and panels.
Panels are mostly used to create customized layouts for multiple uses. You can create a page having different regions. It has a drag and drop content manager. Please read Panels module
I'm trying to figure out what would be best solution to the problem I'm facing. I have a Silverlight application which should be composed from different modules. I can use Prism, place regions and load modules and fill regions with loaded modules but this is not enough in my situation. Here's what I want to accomplish:
For most views that gets loaded from different xap files, I should place an element somewhere in the shell, which will perform navigation to the dynamically loaded view.
That element (which links to dynamically loaded view) should support localization and should have dynamically assignable data templates, different module links should have different content/data template (I'm thinking writing data templates in xaml files on the server and reading them from silverlight via XamlReader, maybe there's a better way?).
Uri mapping and browser journal should work with navigation. Silverlight default navigation mechanism better suits my needs than the one found in Prism.
The architecture should support MVVM.
I think thats all. I just couldn't think of a good architecture which will satisfy all my needs. Any help would be greatly appreciated.
I do not know of a single product/solution that would cover all your requirements, so here are some comments on each:
If one area of the shell has a region that supports multiple items, you just register a control of type link/button etc with the same region name in each module. For example we register views based on the Telerik TadRibbonTab (instead of UserControl) with a region named "views" which is a RibbonBarTab with a region named "views". Every module then adds its its own button to the list. You can do the same thing with any multi-item container.
Localisation is a completely different issue and can be solved in a number of ways. See my answer here: Load Resources ".resx" from folder in Silverlight
A custom navigation mapper can be made to behave like the standard one, without messing up the support for Prism regions. The one we created encodes GUI information such as current selections (current view and item selections etc) into the URL. That means we are in total control of the state and the URL controls the state.
Hardly anything stops you using MVVM as that is one small feature for separating views from code-behind data.
I will be interested in what other solutions are proposed as we are always looking for new ideas too.
I am building a website based on widgets. I have a general WidgetInstancesController class with several methods, a model and some views for it. Now, I want to know if it's possible to extend this class. In other words, each widget should be another class, extending the WidgetInstancesController class. I want to store these widgets classes under app/widgets/. Also, these widgets won't have any specific model (as they will use the parent WidgetInstance model) but may have some specific views.
Any suggestions on how can I do this will be highly appreciated!
I would suggest building them as components, but it can be done in other ways.
I have had to do something similar where I built a CMS with add-on modules. To make it work logically, I had to turn MVC on its head a little and go for a very thin controller. Essentially, the front-end module logic was contained entirely at the Model level, with the associated views as elements. A module helper fetched and displayed the module in the public front-end. The back-end was handled conventionally via MVC with a normal fatness controller.
As it turned out, the Models were surprisingly lightweight and having everything as elements made usability a dream.