Mobile app version of vmapp.org
Login or Join
Berryessa370

: Editable components I would like to include global editable components in a website I am currently making with the 1.4 Symfony framework. Are there any plugin/library/anything that could do that?

@Berryessa370

Posted in: #Cms

I would like to include global editable components in a website I am currently making with the 1.4 Symfony framework. Are there any plugin/library/anything that could do that?

My attempts


The best solution would have been something like www.symfony-project.org/plugins/sfDoctrineEditableComponentPlugin. However:

This plugin is still in alpha.
I could not have it work (though it may be because I made an error during installation)
The slots are not global.

One idea would be to use a CMS. I tried with Apostrophe. However I did not succeed in inserting a_slots in templates of "normal" actions. It seems you can only inserts slots in pages created by Apostrophe. A solution could be to create a template for each pages/action. Then I could create an apostrophe page for each of those templates. But that would mean transferring all the Controller part in the templates, losing the assets of a MVC architecture.
Doing it myself. I could do that, but I would have the feeling of reinventing the wheel. My needs do not seem quite specific, so I hope someone have done it before.


The context

I am currently making a website for an association of theater, dance and music. We produce an average of 1.5 spectacles by month plus some other events. In the current version of the website, I have done a backend application where you can edit all the informations about a given event. However, some people find it hard/weird to need to go to another page. Sometimes they mistake two fields; WYSIWYGs editable components seem perfect to me. They need to be global (indeed the title of an event appear in multiple pages).

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Berryessa370

1 Comments

Sorted by latest first Latest Oldest Best

 

@Murray432

See 'including other templates':-

Quoting from the author...


You'll often want to include the same template or code fragment on
several different pages. For example, in an application with "news
articles", the template code displaying an article might be used on
the article detail page, on a page displaying the most popular
articles, or in a list of the latest articles.

When you need to reuse a chunk of PHP code, you typically move the
code to a new PHP class or function. The same is true for templates.
By moving the reused template code into its own template, it can be
included from any other template. First, create the template that
you'll need to reuse.

Content to reuse


<!-- src/Acme/ArticleBundle/Resources/views/Article/articleDetails.html.php -->
<h2><?php echo $article->getTitle() ?></h2>
<h3 class="byline">by <?php echo $article->getAuthorName() ?></h3>

<p>
<?php echo $article->getBody() ?>
</p>



Include example


<!-- src/Acme/ArticleBundle/Resources/Article/list.html.php -->
<?php $view->extend('AcmeArticleBundle::layout.html.php') ?>

<?php $view['slots']->start('body') ?>
<h1>Recent Articles</h1>

<?php foreach ($articles as $article): ?>
<?php echo $view->render('AcmeArticleBundle:Article:articleDetails.html.php', array('article' => $article)) ?>
<?php endforeach; ?>
<?php $view['slots']->stop() ?>

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme