<?xml version="1.0" encoding="UTF-8" ?><rss version="2.0"><channel><title>BEdita | Semantic Content Management Framework &#45; Blog</title><link>http://www.bedita.com/menu/blog</link><description>BEdita dev blog</description><language>eng</language><item><title>i18n - translation gettext for plugins</title><description>&lt;hr/&gt;&lt;p&gt;In order to generate/merge .po/.pot files for a specific plugin, you can use BEdita gettext shell script.&lt;/p&gt;
&lt;p&gt;The syntax for this command is like:&lt;/p&gt;
&lt;pre class=&quot;brush: php; first-line: 1; tab-size: 4; toolbar: false; &quot;&gt;./cake.sh gettext update -plugin &amp;lt; plugin-name &amp;gt;&lt;/pre&gt;</description><pubDate>Fri, 31 Aug 2012 15:29:45 +0200</pubDate><link>http://www.bedita.com/menu/blog/i18n-translation-gettext-for-plugins</link><guid>http://www.bedita.com/menu/blog/i18n-translation-gettext-for-plugins</guid></item><item><title>If something goes wrong - 4 steps</title><description>4 simple steps to follow if your BEdita applications are not working&lt;hr/&gt;&lt;p&gt;Your application is not responding, you have a blank page, some elements are not displayed, page layout is broken, you get mysterious error messages.....but you don&#039;t know what&#039;s going wrong and how to fix it? Ok, don&#039;t panic :-)&lt;/p&gt;
&lt;p&gt;Here a simple checklist in four steps to use in such situations:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;debug level - core.php&lt;/strong&gt; - it&#039;s a common practice to set a debug level during development/testing of your application, you do so by setting &lt;em&gt;Configure::write(&#039;debug&#039;, 1);&lt;/em&gt; in &lt;span style=&quot;text-decoration: underline;&quot;&gt;bedita-app/config/core.php&lt;/span&gt; in backend or in &lt;span style=&quot;text-decoration: underline;&quot;&gt;frontends/&lt;em&gt;[frontend-name]&lt;/em&gt;/config/core.php&lt;/span&gt; in your specific &lt;em&gt;[frontend-name]&lt;/em&gt; frontend. It may help: additional information should be displayed in your browser and in log files. Remember to remove debug level by setting &lt;em&gt;Configure::write(&#039;debug&#039;, 0) &lt;/em&gt;for a production system.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;view BEdita log files&lt;/strong&gt; - backend log files are in &lt;span style=&quot;text-decoration: underline;&quot;&gt;bedita-app/tmp/logs&lt;/span&gt; folder for backend and in &lt;span style=&quot;text-decoration: underline;&quot;&gt;frontends/&lt;em&gt;[frontend-name]&lt;/em&gt;/tmp/logs&lt;/span&gt; for your &lt;em&gt;[frontend-name]&lt;/em&gt; frontend. Look at &lt;em&gt;error.log&lt;/em&gt; file first, then view &lt;em&gt;debug.log&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;view web servers log files&lt;/strong&gt; - if you&#039;re using Apache usually these files are located in a common log directory for your web server, but you can specify other custom log directories for both backend and frontend. In typical Unix setup you may find these files in &lt;span style=&quot;text-decoration: underline;&quot;&gt;/var/log/apache2/&lt;/span&gt; (without custom log directories). Read &lt;span style=&quot;text-decoration: underline;&quot;&gt;&lt;em&gt;error.log&lt;/em&gt;&lt;/span&gt; first, then look at &lt;span style=&quot;text-decoration: underline;&quot;&gt;&lt;em&gt;access.log&lt;/em&gt;&lt;/span&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;get online support&lt;/strong&gt; - if the problem is still obscure, write to our &lt;a title=&quot;BEdita google group&quot; href=&quot;https://groups.google.com/forum/#!forum/bedita&quot; target=&quot;_blank&quot;&gt;google group to get support&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt; &lt;/p&gt;</description><pubDate>Mon, 19 Mar 2012 18:10:21 +0100</pubDate><link>http://www.bedita.com/menu/blog/if-something-goes-wrong-in-bedita</link><guid>http://www.bedita.com/menu/blog/if-something-goes-wrong-in-bedita</guid></item><item><title>Showing a list of tags</title><description>Get a tag cloud or tag list in your frontend application&lt;hr/&gt;&lt;p&gt;Get a tag cloud or tag list in your frontend application&lt;/p&gt;&lt;hr/&gt;&lt;p&gt;Let&#039;s see how you can show a list or cloud of tags in BEdita frontends.&lt;/p&gt;
&lt;p&gt;If you want to show them in every page of your frontend you should use the &lt;strong&gt;beditaBeforeRender()&lt;/strong&gt; callback in your &lt;strong&gt;PagesController&lt;/strong&gt;:&lt;/p&gt;
&lt;pre class=&quot;brush: php; first-line: 1; tab-size: 4; toolbar: false; &quot;&gt;protected function beditaBeforeRender() {
   $this-&amp;gt;loadTags();
}
&lt;/pre&gt;
&lt;p&gt;in this way an array named &lt;code&gt;$listTags&lt;/code&gt; will be set for the view. That array will contain all tags ordered by label related to, at least, a content in your publication. You can customize your tags list/cloud with some parameters.&lt;/p&gt;
&lt;pre class=&quot;brush: php; first-line: 1; tab-size: 4; toolbar: false; &quot;&gt;loadTags( $tplVar=null, $cloud=true, $shuffle=false, $tagShowed=null )&lt;/pre&gt;
&lt;p&gt;where:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;$tplVar&lt;/strong&gt; is the name of view variable&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;$cloud&lt;/strong&gt; says if has to be set a css class for cloud view. Possible css class values are  &lt;em&gt;smallestTag&lt;/em&gt;, &lt;em&gt;largestTag&lt;/em&gt;, &lt;em&gt;largeTag&lt;/em&gt;, &lt;em&gt;mediumTag&lt;/em&gt;, &lt;em&gt;smallTag&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;$shuffle&lt;/strong&gt; says if the tags have to be shuffled or shown in order by label&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;$tagShowed&lt;/strong&gt; is the number of tags that will be in the result array&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;So if you want to load 30 tags shuffled in cloud mode you will call&lt;/p&gt;
&lt;pre class=&quot;brush: php; first-line: 1; tab-size: 4; toolbar: false; &quot;&gt;$this-&amp;gt;loadTags(null, true, true, 30);&lt;/pre&gt;
&lt;h2&gt;Tags view&lt;/h2&gt;
&lt;p&gt;In the view you will have &lt;strong&gt;$listTags&lt;/strong&gt;array as:&lt;/p&gt;
&lt;pre class=&quot;brush: php; first-line: 1; tab-size: 4; toolbar: false;&quot;&gt;Array (
    [0] =&amp;gt; Array (
       [&#039;id&#039;] =&amp;gt; 1
       [&#039;area_id&#039;] =&amp;gt; 
       [&#039;label&#039;] =&amp;gt; &#039;my tag&#039;
       [&#039;name&#039;] =&amp;gt; &#039;my-tag&#039;
       [&#039;object_type_id&#039;] =&amp;gt; 
       [&#039;priority&#039;] =&amp;gt; 
       [&#039;parent_id&#039;] =&amp;gt; 
       [&#039;parent_path&#039;] =&amp;gt; 
       [&#039;status&#039;] =&amp;gt; &#039;on&#039;
       [&#039;url_label&#039;] =&amp;gt; &#039;my-tag&#039;
       [&#039;weight&#039;] =&amp;gt; 100
       [&#039;class&#039;] =&amp;gt; &#039;largeTag&#039;
    ),
   [1] =&amp;gt; Array(...)
   ...
);&lt;/pre&gt;
&lt;p&gt;where you can see that tag named &quot;my tag&quot; is related to 100 items (&lt;em&gt;weight&lt;/em&gt;) and the css class &lt;em&gt;largeTag&lt;/em&gt; should be applied to &quot;my tag&quot; to generate the cloud. The &lt;em&gt;name&lt;/em&gt; and &lt;em&gt;url_label&lt;/em&gt; fields are equal for backward compatibility but we suggest to use only &lt;em&gt;name&lt;/em&gt; field because &lt;em&gt;url_label&lt;/em&gt; will be deprecated in the future.&lt;br /&gt;&lt;br /&gt;A new element to use in views named tag_cloud will be added soon, but for now you can create one by your own. It&#039;s straightforward: add the file &lt;strong&gt;app/views/elements/tag_cloud.tpl&lt;/strong&gt; and, for example, add the code:&lt;/p&gt;
&lt;pre class=&quot;brush: js; first-line: 1; tab-size: 4; toolbar: false; &quot;&gt;{if !empty($listTags)}
    &amp;lt; h2 &amp;gt;{t}Tag cloud{/t}&amp;lt; /h2 &amp;gt;
    {foreach from=$listTags item=tag}
        &amp;lt; a class=&quot;tagCloud {$tag.class|default:&quot; title=&quot;{$tag.weight}&quot; 
             href=&quot;{$html-&amp;gt;url(&#039;/tag/&#039;)}{$tag.name}&quot; &amp;gt;{$tag.label}&amp;lt; /a &amp;gt;
    {/foreach}
{/if}&lt;/pre&gt;
&lt;p&gt;add to your CSS something as:&lt;/p&gt;
&lt;pre class=&quot;brush: css; first-line: 1; tab-size: 4; toolbar: false; &quot;&gt;.smallestTag {
    font-size:1em;
}
.smallTag {
    font-size:1.2em;
}
.mediumTag {
    font-size:1.4em;
}
.largeTag {
    font-size:1.8em;
}
.largestTag {
    font-size:2.2em;
}
&lt;/pre&gt;
&lt;p&gt;and you will have your tag cloud ready to use. Now you can call the element wherever you want using:&lt;/p&gt;
&lt;pre class=&quot;brush: php; first-line: 1; tab-size: 4; toolbar: false; &quot;&gt;{$view-&amp;gt;element(&#039;tag_cloud&#039;)}&lt;/pre&gt;
&lt;p&gt;in your views.&lt;/p&gt;</description><pubDate>Thu, 19 Jan 2012 11:15:07 +0100</pubDate><link>http://www.bedita.com/menu/blog/showing-a-list-of-tags</link><guid>http://www.bedita.com/menu/blog/showing-a-list-of-tags</guid></item><item><title>Managing Users History</title><description>Manage easly users history in frontend applications (and in backend too)&lt;hr/&gt;&lt;p&gt;Manage easly users history in frontend applications (and in backend too)&lt;/p&gt;&lt;hr/&gt;&lt;p&gt;Manage users navigation history is a common scenario developing frontend applications and BEdita comes with an integrated system to handle it.&lt;/p&gt;
&lt;p&gt;To activate history tracking just edit &lt;strong&gt;config/frontend.ini.php&lt;/strong&gt; in your frontend application and uncomment:&lt;/p&gt;
&lt;pre class=&quot;brush: php; first-line: 1; tab-size: 4; toolbar: false; &quot;&gt;$config[&quot;history&quot;] = array(
   &quot;sessionEntry&quot; =&amp;gt; 5,
   &quot;showDuplicates&quot; =&amp;gt; false,
   &quot;trackNotLogged&quot; =&amp;gt; false
);&lt;/pre&gt;
&lt;p&gt;where:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;sessionEntry&lt;/strong&gt; is the number of history items you want to have in session&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;showDuplicates&lt;/strong&gt; says if duplicate history items have to show in session&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;trackNotLogged&lt;/strong&gt; says if history of unsigned users has to be active&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Automatically BEdita will trace users activity in &lt;em&gt;history&lt;/em&gt; table and fill &lt;span style=&quot;text-decoration: underline;&quot;&gt;&lt;em&gt;History&lt;/em&gt;&lt;/span&gt; array in session.&lt;/p&gt;
&lt;p&gt;In &lt;code&gt;$BEAuthUser&lt;/code&gt; variable (views variable for user session info) you will have for example:&lt;/p&gt;
&lt;pre class=&quot;brush: javascript; first-line: 1; tab-size: 4; toolbar: false; &quot;&gt;[&#039;History&#039;] =&amp;gt; Array(
   [0] =&amp;gt; Array(
      [&#039;area_id&#039;] =&amp;gt; 1
      [&#039;object_id&#039;] =&amp;gt; 3
      [&#039;title&#039;] =&amp;gt; //This is the title of content
      [&#039;url&#039;] =&amp;gt; //url-to-that-content
      [&#039;user_id&#039;] =&amp;gt; 1
      [&#039;id&#039;] =&amp;gt; 1
   ),
   [1] =&amp;gt; Array(...)
   ...
);&lt;/pre&gt;
&lt;p&gt;Ajax and Flash calls are not inserted in history and you can always control what you want to end up in history through out the &lt;code&gt;AppController::historyItem&lt;/code&gt; property. Setting it to null you avoids to register history in some cases.&lt;/p&gt;
&lt;p&gt;For example if you don&#039;t want access to a content with unique name &quot;mycontent&quot; to be tracked, then you can add to PagesController:&lt;/p&gt;
&lt;pre class=&quot;brush: php; first-line: 1; tab-size: 4; toolbar: false; &quot;&gt;protected function mycontentBeforeFilter() {
   $this-&amp;gt;historyItem = null;
}&lt;/pre&gt;
&lt;p&gt;If you need you can also manage users history in BEdita backend: just uncomment from &lt;strong&gt;bedita-app/config/bedita.cfg.php&lt;/strong&gt; &lt;code&gt;$config[&quot;history&quot;]&lt;/code&gt; array.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;</description><pubDate>Wed, 18 Jan 2012 13:05:02 +0100</pubDate><link>http://www.bedita.com/menu/blog/manage-users-history</link><guid>http://www.bedita.com/menu/blog/manage-users-history</guid></item><item><title>Get more or less information from your content</title><description>How to handle BEdita objects model bindings in frontend applications&lt;hr/&gt;&lt;p&gt;How to handle BEdita objects model bindings in frontend applications&lt;/p&gt;&lt;hr/&gt;&lt;p&gt;In frontend application you can control how many informations you want from your content. This means to read more or less fields from database throughout CakePHP associations and Containable Behavior. To see the associations of BEdita object models you should have a look at models definitions.&lt;/p&gt;
&lt;p&gt;In every BEdita object model you can also see a class property named &lt;code&gt;$modelBindings&lt;/code&gt; that is an array of different level of bindings. In frontend applications the default modelBindings should be defined from &lt;strong&gt;&quot;frontend&quot;&lt;/strong&gt; key of array, for example in Document model you have:&lt;/p&gt;
&lt;pre class=&quot;brush: php; first-line: 1; tab-size: 4; toolbar: false; &quot;&gt;$modelBindings = array(
   &quot;detailed&quot; =&amp;gt; array(...),
   &quot;default&quot; =&amp;gt; array(...),
   &quot;minimum&quot; =&amp;gt; array(...),
   &quot;frontend&quot; =&amp;gt; array(
      &quot;BEObject&quot; =&amp;gt; array(
         &quot;LangText&quot;,
         &quot;UserCreated&quot;,
         &quot;RelatedObject&quot;,
         &quot;Category&quot;,
         &quot;Annotation&quot;
      ),
      &quot;GeoTag&quot;
   )
);&lt;/pre&gt;
&lt;p&gt;Document::modelBindings[&quot;frontend&quot;] is the default bindings used when a document is loaded. Of course you can override this default in many way. Every time that a BEdita object is loaded through FrontendController::loadObj() method (that is the standard way to load every BEdita object in frontend applications) BEdita chooses what model bindings to use follow the below order:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;FrontendController::modelBindings[&quot;BEditaObjectName&quot;]&lt;/code&gt;&lt;br /&gt;You can set &lt;code&gt;$modelBindings&lt;/code&gt; property in your controller to define in general or in a specific point what associations have to be used. If you use it in a specific method remember to reset the property to avoid using those model bindings everywhere.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;$config[&quot;modelBindings&quot;]&lt;/code&gt; in &lt;code&gt;app/config/frontend.ini.php&lt;/code&gt;&lt;br /&gt;This is useful if you want that your default model bindings for a frontend are different from those defined in the respective model.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;BEditaObjectModel::modelBindings[&quot;frontend&quot;]&lt;/code&gt; the default as explained above&lt;br /&gt;Example: &lt;code&gt;Document::modelBindings[&quot;frontend&quot;]&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;BEditaObjectModel::modelBindings[&quot;minimum&quot;]&lt;/code&gt;, this is the fallback if default above is not defined&lt;/li&gt;
&lt;li&gt;if it also miss &quot;minimum&quot; model bindings then an exception is thrown. In this case your model is buggy. Fix it.&lt;/li&gt;
&lt;/ol&gt;</description><pubDate>Thu, 20 Oct 2011 17:55:51 +0200</pubDate><link>http://www.bedita.com/menu/blog/get-more-or-less-information-from-your-content</link><guid>http://www.bedita.com/menu/blog/get-more-or-less-information-from-your-content</guid></item><item><title>Error logs: &#039;missingController&#039; message</title><description>This article is about error log messages and the &lt;em&gt;strange&lt;/em&gt;/&lt;em&gt;mysterious&lt;/em&gt; &#039;missingController&#039; message&lt;hr/&gt;&lt;p&gt;This article is about error log messages and the &lt;em&gt;strange&lt;/em&gt;/&lt;em&gt;mysterious&lt;/em&gt; &#039;missingController&#039; message&lt;/p&gt;&lt;hr/&gt;&lt;p&gt;As you may know &lt;strong&gt;BEdita&lt;/strong&gt; uses standard &lt;a title=&quot;CakePHP logging&quot; href=&quot;http://book.cakephp.org/view/1194/Logging&quot; target=&quot;_blank&quot;&gt;&lt;strong&gt;CakePHP&lt;/strong&gt; log&lt;/a&gt; files for its own logging system.&lt;/p&gt;
&lt;p&gt;You have different sets of log files for your backend application and for every frontend application/site, namely:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;in &lt;code&gt;bedita/bedita-app/tmp/logs &lt;/code&gt;for backend error.log/debug.log files&lt;/li&gt;
&lt;li&gt;in &lt;code&gt;bedita/frontends/www.myfrontend.com/tmp/logs &lt;/code&gt;for every frontend, where path will change (substitute www.myfrontend.com with the actual frontend dir name), with usual error.log/debug.log files&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;To write in these log files use the &lt;code&gt;$this-&amp;gt;log()&lt;/code&gt; method inside every BEdita controller or model.&lt;/p&gt;
&lt;p&gt;Here you will find, for example, exceptions related messages, such as stack traces, like:&lt;/p&gt;
&lt;pre class=&quot;brush: php; first-line: 1; gutter: false; tab-size: 4; toolbar: false; &quot;&gt;2011-01-11 11:11:11 Error: BeditaException - Error: object type not found File: bedita-app/models/objects/b_e_object.php - line: 522 Trace:
#0 bedita-app/controllers/frontend_controller.php(1211): BEObject-&amp;gt;getType(false)
#1 [internal function]: FrontendController-&amp;gt;section(&#039;blog&#039;, &#039;img&#039;, &#039;loadingAnimatio...&#039;)
#2 bedita-app/controllers/frontend_controller.php(1382): call_user_func_array(Array, Array)
...&lt;/pre&gt;
&lt;p&gt;That refers to some unexpected error. You may inspect this log file to find possbile bugs or unwanted behaviours of your application. These log messages can be hard to understand but if you follow source files/line numbers you may find out what the problem is.&lt;/p&gt;
&lt;p&gt;Typical messages are classic HTTP 404/500 error messages like&lt;/p&gt;
&lt;pre class=&quot;brush: php; first-line: 1; gutter: false; smart-tabs: false; tab-size: 4; toolbar: false; &quot;&gt;2010-12-13 18:47:21 Error:  500 Internal Error - missingTable: array (...)
...&lt;/pre&gt;
&lt;p&gt;&lt;code&gt; &lt;/code&gt;Other log messages are definitely more cryptic/mysterious. For example this one that we were investigating these days:&lt;/p&gt;
&lt;pre class=&quot;brush: php; first-line: 1; gutter: false; tab-size: 4; toolbar: false; &quot;&gt;2011-03-10 10:43:42 Error:  404 Not Found - missingController: array (
   &#039;BEAuthUser&#039; =&amp;gt; ...
   &#039;controller&#039; =&amp;gt; &#039;JsController&#039;,
   &#039;controllerName&#039; =&amp;gt; &#039;Js&#039;,
) &lt;/pre&gt;
&lt;p&gt;Seems like an attempt to retrieve something through an URL like &lt;code&gt;/js/...&lt;/code&gt; that is normally used for javascript files. This indicates that some of your javascript links are broken, you are probably linking to a missing js file. Same applies to css or image files, for which you will find a missing &lt;strong&gt;CssController&lt;/strong&gt; o &lt;strong&gt;ImgController&lt;/strong&gt; in your log files.&lt;/p&gt;
&lt;p&gt;To easily find out which links are broken we suggest you to use a tool like &lt;a href=&quot;http://getfirebug.com/&quot; target=&quot;_blank&quot;&gt;Firebug&lt;/a&gt;: enable &quot;Net&quot; view and look for 404 errors in HTTP GET calls highlited in red. Look at the screenshots in this page for an example.&lt;/p&gt;</description><pubDate>Tue, 15 Mar 2011 16:26:04 +0100</pubDate><link>http://www.bedita.com/menu/blog/error-logs-missingcontroller-message</link><guid>http://www.bedita.com/menu/blog/error-logs-missingcontroller-message</guid></item><item><title>Template development - beFront helper</title><description>This article explains how to use BeFrontHelper in frontend template development&lt;hr/&gt;&lt;p&gt;This article explains how to use BeFrontHelper in frontend template development&lt;/p&gt;&lt;hr/&gt;&lt;p&gt;When you work on templates using CakePhp, you use (or should use) cake helpers (for instance: &lt;code&gt;FormHelper&lt;/code&gt;, &lt;code&gt;HtmlHelper&lt;/code&gt;, &lt;code&gt;JavascriptHelper&lt;/code&gt;, etc.). If you don&#039;t know what an &lt;code&gt;Helper&lt;/code&gt; is, take a look at &lt;a href=&quot;http://book.cakephp.org/#!/view/1095/Helpers&quot;&gt;cakephp documentation page about helpers&lt;/a&gt;, before continuing to read this article.&lt;br /&gt;&lt;br /&gt;In BEdita you can use CakePhp helpers and BEdita helpers as well, powered by the Smarty Template Engine syntax (more details about Smarty syntax can be found in &lt;a href=&quot;http://www.smarty.net/docs/en/&quot;&gt;Smarty Documentation&lt;/a&gt;). BEdita helper names start with &quot;Be&quot;: &lt;code&gt;BeEmbedFlashHelper&lt;/code&gt;, &lt;code&gt;BeEmbedMediaHelper&lt;/code&gt;, &lt;code&gt;BeFrontHelper&lt;/code&gt;, &lt;code&gt;BeThumbHelper&lt;/code&gt;, &lt;code&gt;BeTimeHelper&lt;/code&gt;, &lt;code&gt;BeToolbarHelper&lt;/code&gt;, &lt;code&gt;BeTreeHelper&lt;/code&gt;, &lt;code&gt;BeurlHelper&lt;/code&gt; (check them in &lt;a href=&quot;http://api.bedita.com/&quot;&gt;BEdita API documentation&lt;/a&gt;).&lt;br /&gt;&lt;br /&gt;No matter the type of the Web application or site or whatever you are building, in frontend templates development you have to face several common tasks: the default template page usually contains a title, a description, a block of keywords, some metadata, a menu, some statistics, feeds, a breadcrumb block, and so on.&lt;br /&gt;BeFrontHelper&#039;s aim is to help template developer with most common tasks, dealing with &quot;templates topics&quot; more than &quot;controller/business logic&quot;. Developing BeFrontHelper, BEdita staff studied deeply SEO issues and metadata management: business logic reflects some decisions taken by BEdita developers discussing SEO documentation.&lt;/p&gt;
&lt;p&gt;Let&#039;s see an example from dummy example site in bedita &quot;ulmus&quot; release: &lt;code&gt;bedita-3.1-ulmus/frontends/dummy.example.com/views/layouts/default.tpl&lt;/code&gt;.&lt;/p&gt;
&lt;pre class=&quot;brush: xml; first-line: 1; tab-size: 4; toolbar: false; &quot;&gt;{$html-&amp;gt;docType(&#039;xhtml-trans&#039;)}
&amp;lt; html xmlns=&quot;http://www.w3.org/1999/xhtml&quot; lang=&quot;{$currLang}&quot; dir=&quot;ltr&quot; &amp;gt;
   &amp;lt; head &amp;gt;
      {$html-&amp;gt;charset()}
      &amp;lt; title &amp;gt;
         {$beFront-&amp;gt;title()}
      &amp;lt; / title &amp;gt;
      {$beFront-&amp;gt;metaAll()}
      {$beFront-&amp;gt;metaDc()}
      &amp;lt; link rel=&quot;icon&quot; href=&quot;{$html-&amp;gt;webroot}favicon.png&quot; type=&quot;image/png&quot; / &amp;gt;
      {$beFront-&amp;gt;feeds()}
      {$scripts_for_layout}
   &amp;lt; / head &amp;gt;
   &amp;lt; body &amp;gt;
      {$view-&amp;gt;element(&#039;header&#039;)}
      {$content_for_layout}
      {$view-&amp;gt;element(&#039;footer&#039;)}
      {$beFront-&amp;gt;stats()}
   &amp;lt; / body &amp;gt;
&amp;lt; / html &amp;gt;&lt;/pre&gt;
&lt;p&gt;In this example, BeFrontHelper is used in 5 calls, respectively the methods are &quot;title&quot;, &quot;metaAll&quot;, &quot;metaDc&quot;, &quot;feeds&quot; and &quot;stats&quot;. Lets see what these methods (and some others) do.&lt;/p&gt;
&lt;h1&gt;{$beFront-&amp;gt;title()}&lt;/h1&gt;
&lt;p&gt;BeFrontHelper function title return a default title for a page, according to page content and/or section/publication.&lt;/p&gt;
&lt;p&gt;The title is like: &quot;publication title/publication name&quot; - &quot;section title/current content title&quot;.&lt;br /&gt;A good SEO point: distinguish titles inside a Web application or Website, according to real context content of a page.&lt;br /&gt;This method works in that direction.&lt;/p&gt;
&lt;h1&gt;{$beFront-&amp;gt;metaAll()}&lt;/h1&gt;
&lt;p&gt;&lt;code&gt;{$beFront-&amp;gt;metaAll()}&lt;/code&gt; generates html tags for content metadata: &quot;description&quot;, &quot;author&quot;, &quot;http-equiv&quot; and &quot;generator&quot;.&lt;br /&gt;&quot;Description&quot; is the first not empty value among the following:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;currentContent[&quot;description&quot;]&lt;/li&gt;
&lt;li&gt;currentContent[&quot;abstract&quot;] truncated to 255 characters&lt;/li&gt;
&lt;li&gt;currentContent[&quot;body&quot;] truncated to 255 characters&lt;/li&gt;
&lt;li&gt;section[&quot;description&quot;]&lt;/li&gt;
&lt;li&gt;publication[&quot;description&quot;]&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Note: meta &quot;description&quot; can be obtained separately calling the method:&lt;/p&gt;
&lt;pre class=&quot;brush: php; first-line: 1; gutter: false; tab-size: 4; toolbar: false; &quot;&gt;{$beFront-&amp;gt;metaDescription()}&lt;/pre&gt;
&lt;p&gt;&quot;Author&quot; meta tag can be omitted, in case &quot;license&quot; field is not found in the following objects:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;currentContent&lt;/li&gt;
&lt;li&gt;section&lt;/li&gt;
&lt;li&gt;publication&lt;/li&gt;
&lt;/ul&gt;
&lt;h1&gt;{$beFront-&amp;gt;metaDc()}&lt;/h1&gt;
&lt;p&gt;It returns html-DC tags &lt;code&gt;DC.title&lt;/code&gt;, &lt;code&gt;DC.description&lt;/code&gt;, &lt;code&gt;DC.format&lt;/code&gt;, &lt;code&gt;DC.language&lt;/code&gt;, &lt;code&gt;DC.creator&lt;/code&gt;, &lt;code&gt;DC.publisher&lt;/code&gt;, &lt;code&gt;DC.date&lt;/code&gt;, &lt;code&gt;DC.modified&lt;/code&gt;, &lt;code&gt;DC.identifier&lt;/code&gt;, &lt;code&gt;DC.rights&lt;/code&gt;, &lt;code&gt;DC.license&lt;/code&gt;. For more details about Dublin Core Html Tags, look at &lt;a href=&quot;http://www.dublincore.org/documents/dcq-html/&quot;&gt;Expressing Dublin Core in HTML/XHTML meta and link elements&lt;/a&gt;.&lt;/p&gt;
&lt;h1&gt;{$beFront-&amp;gt;feeds()}&lt;/h1&gt;
&lt;p&gt;When there are feeds, this method display feeds links; for instance:&lt;/p&gt;
&lt;pre class=&quot;brush: xml; first-line: 1; gutter: false; tab-size: 4; toolbar: false; &quot;&gt;&amp;lt; link rel=&quot;alternate&quot; type=&quot;application/rss+xml&quot; title=&quot;Blog&quot; href=&quot;/rss/blog&quot; / &amp;gt;
&amp;lt; link rel=&quot;alternate&quot; type=&quot;application/rss+xml&quot; title=&quot;News&quot; href=&quot;/rss/news&quot; / &amp;gt;&lt;/pre&gt;
&lt;p&gt; &lt;/p&gt;
&lt;h1&gt;{$beFront-&amp;gt;stats()}&lt;/h1&gt;
&lt;p&gt;It returns publication stats code, if set (only if frontend app is not staging site).&lt;/p&gt;
&lt;h1&gt;{$beFront-&amp;gt;menu()}&lt;/h1&gt;
&lt;p&gt;Tree structure returned in html unordered list, with links to the contents.&lt;/p&gt;
&lt;h1&gt;{$beFront-&amp;gt;breadcrumb()}&lt;/h1&gt;
&lt;p&gt;It returns the breadcrumb trail for the page.&lt;/p&gt;
&lt;p&gt;--&lt;br /&gt;Let&#039;s say something about smarty variables used in the examples of this article.&lt;br /&gt;&lt;br /&gt;The variables &lt;code&gt;{$currentContent}&lt;/code&gt;, &lt;code&gt;{$section}&lt;/code&gt;, &lt;code&gt;{$publication}&lt;/code&gt; refer to BEdita objects set by FrontendController.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;{$currentContent}&lt;/code&gt; is the main object of the page (can be referred directly through url like &lt;a href=&quot;http://www.bedita.com/blog/template-development-befront-helper&quot;&gt;http://www.bedita.com/blog/template-development-befront-helper&lt;/a&gt;). &lt;code&gt;{$currentContent[&quot;description&quot;]}&lt;/code&gt;, &lt;code&gt;{$currentContent[&quot;abstract&quot;]}&lt;/code&gt; and &lt;code&gt;{$currentContent[&quot;body&quot;]}&lt;/code&gt; refer to the content of Document-&amp;gt;description, Document-&amp;gt;short text and Document-&amp;gt;long text of the Document view in Bedita backend application (for example &lt;code&gt;http://mybeditaapp/documents/view/&lt;/code&gt;).&lt;br /&gt;&lt;br /&gt;&lt;code&gt;{$section}&lt;/code&gt; and &lt;code&gt;{$publication}&lt;/code&gt; are respectively Section and Publication objects for the url, if any. For example this document is inside Section &quot;blog&quot; of Publication &quot;BEditafrontsite&quot;, and the &lt;code&gt;{$currentContent}&lt;/code&gt; in this page is the Document that you are reading.&lt;code&gt;&lt;code&gt;&lt;code&gt;&lt;code&gt;&lt;/code&gt;&lt;/code&gt;&lt;/code&gt;&lt;/code&gt;&lt;/p&gt;</description><pubDate>Wed, 09 Mar 2011 09:17:03 +0100</pubDate><link>http://www.bedita.com/menu/blog/template-development-befront-helper</link><guid>http://www.bedita.com/menu/blog/template-development-befront-helper</guid></item><item><title>How to subscribe users to frontend apps</title><description>This article explains what you have to do to register users through a frontend application&lt;hr/&gt;&lt;p&gt;This article explains what you have to do to register users through a frontend application&lt;/p&gt;&lt;hr/&gt;&lt;p&gt;Register users in a frontend application is a common scenario. The subscribing action is handled out of the box by BEdita 3.1 through two methods of FrontendController. The first one is &lt;strong&gt;FrontendController::subscribe() &lt;/strong&gt;action that takes care of showing the proper signup form in the view.&lt;/p&gt;
&lt;p&gt;Assuming your frontend app is www.example.com then point your browser to &lt;strong&gt;www.example.com/subscribe/user&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;If you are developing your frontend starting from bedita/frontends/dummy.example.com (if not you should) you will have &lt;strong&gt;views/pages/subscribe.tpl&lt;/strong&gt; that uses &lt;strong&gt;views/elements/signup.tpl&lt;/strong&gt;, view templates that you can easily modify if necessary&lt;strong&gt;.&lt;br /&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;In the browser you should see a subscribtion form with some data to fill. Form submission will start the subscribe process calling &lt;strong&gt;FrontendController::hashjob() &lt;/strong&gt;method. &lt;br /&gt;A user and an associated card object (that you can see/handle in Addressbook module) will be created and an email will be sent to the user to confirm the subscription through a link with unique hash. The user will be in &quot;invalid&quot; mode (login blocked) until the subscription will be confirmed. If you don&#039;t want to create the card object remove the input:&lt;/p&gt;
&lt;pre class=&quot;brush: xml; first-line: 1; gutter: false; tab-size: 4; toolbar: false; &quot;&gt;&lt;input type=&quot;text&quot; name=&quot;data[Card][name]&quot; /&gt;&lt;/pre&gt;
&lt;p&gt;Instead if you want more card details add others input according to &lt;em&gt;&lt;strong&gt;cards&lt;/strong&gt;&lt;/em&gt; table, for example:&lt;/p&gt;
&lt;pre class=&quot;brush: xml; first-line: 1; gutter: false; tab-size: 4; toolbar: false; &quot;&gt;&lt;input type=&quot;text&quot; name=&quot;data[Card][street_address]&quot; /&gt;

&lt;input type=&quot;text&quot; name=&quot;data[Card][company_name]&quot; /&gt;&lt;/pre&gt;
&lt;p&gt;The fields &lt;em&gt;street_address&lt;/em&gt; and &lt;em&gt;company_name&lt;/em&gt; of &lt;em&gt;&lt;strong&gt;cards&lt;/strong&gt;&lt;/em&gt; table will be populated by the input form data.&lt;/p&gt;
&lt;p&gt;By default a subscribed user will be associated also to the groups defined in &lt;strong&gt;&quot;authorizedGroups&quot;&lt;/strong&gt; array in &lt;strong&gt;frontendapp/config/frontend.ini.php&lt;/strong&gt; file. If the array is empty the user will be associated to all non-backend groups, that you can manage in &lt;strong&gt;Administration &lt;/strong&gt;&lt;span style=&quot;font-family: mceinline;&quot;&gt;module&lt;/span&gt; .&lt;/p&gt;
&lt;p&gt;Alternatively you can use the hashjobBeforeFilter() callback, writing in PagesController something like:&lt;/p&gt;
&lt;pre class=&quot;brush: php; first-line: 1; tab-size: 4; toolbar: false; &quot;&gt;function hashjobBeforeFilter() {
   if (!empty($this-&amp;gt;passedArgs[0]) &amp;amp;&amp;amp; $this-&amp;gt;passedArgs[0] == &quot;user_sign_up&quot;) {
      $this-&amp;gt;data[&quot;groups&quot;] = array(&quot;group_1&quot;, &quot;group_2&quot;);
   }
} &lt;/pre&gt;
&lt;p&gt;Once user is activated he can log in frontend app pointing to &lt;strong&gt;www.example.com/login&lt;/strong&gt;&lt;/p&gt;</description><pubDate>Wed, 23 Feb 2011 10:25:05 +0100</pubDate><link>http://www.bedita.com/menu/blog/how-to-subscribe-users-to-frontend-app</link><guid>http://www.bedita.com/menu/blog/how-to-subscribe-users-to-frontend-app</guid></item><item><title>Frontend Application Flow and callback methods</title><description>To help the frontend developers BEdita comes with a series of callback methods that allowing to filter and handling data. Understanding how the flow of frontend applications works and which callbacks the developer has in hand is one of the fundamental things to start developing a custom frontend&lt;hr/&gt;&lt;p&gt;To help the frontend developers BEdita comes with a series of callback methods that allows to filter and handle data. Understanding how the flow of frontend applications works and which callbacks the developer has in hand is one of the fundamental things to start developing a custom frontend&lt;/p&gt;&lt;hr/&gt;&lt;p&gt;To fit variegated needs that you can encounter developing a frontend application, BEdita comes with a series of callback methods that allow to find and handle data. Before having a look at this callbacks let&#039;s go to see what happens in a standard frontend flow.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;note:&lt;/strong&gt; the &lt;em style=&quot;color: grey;&quot;&gt;italic grey text parts&lt;/em&gt; referred to BEdita 3.1 version. In BEdita 3.0.x series is missing.&lt;/p&gt;
&lt;h1&gt;Frontend Application Flow&lt;/h1&gt;
&lt;p&gt;Supposing we have a BEdita publication reachable from &lt;code&gt;http://www.example.com&lt;/code&gt; and we want to see the contents of a section with nickname &lt;em&gt;section-1&lt;/em&gt;, in browser address bar we&#039;ll write&lt;/p&gt;
&lt;p&gt;&lt;code&gt;http://www.example.com/section-1&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Everything that doesn&#039;t start with &lt;em&gt;pages&lt;/em&gt; is handled by &lt;strong&gt;route&lt;/strong&gt; method that decide what to do. So if you have a custom method in Pages Controller you can call it in standard CakePHP mode&lt;/p&gt;
&lt;p&gt;&lt;code&gt;http://www.example.com/pages/myCustomMethod&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;route&lt;/strong&gt; method gets first parameters passed by URL (in our case &lt;em&gt;section-1&lt;/em&gt;), check if it&#039;s a reserved word as defined in configuration files and eventually try to call method with that name. So you could put in your &lt;strong&gt;bedita-app/config/bedita.cfg.php&lt;/strong&gt; the reserved word &lt;em&gt;myCustomMethod&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;$config[&quot;cfgReservedWords&quot;] = array(&quot;myCustomMethod&quot;);&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;and call directly &lt;code&gt;http://www.example.com/myCustomMethod&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;If none reserved word is found then BEdita consider the parameter a nickname, check if it corresponds to a section object or not and call respectively &lt;strong&gt;section&lt;/strong&gt; method or &lt;strong&gt;content&lt;/strong&gt; method. These two methods will load all section and contents data and set to view the array &lt;code&gt;$section&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Finally the view is rendered.&lt;/p&gt;
&lt;h1&gt;Callback Methods&lt;/h1&gt;
&lt;p&gt;There are two (&lt;em style=&quot;color: grey;&quot;&gt;four in 3.1 release&lt;/em&gt;) main callbacks always called that can be used to insert logic before or after controller actions:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em style=&quot;color: grey;&quot;&gt;&lt;strong style=&quot;color: grey;&quot;&gt;beforeCheckLogin&lt;/strong&gt; (present from 3.1 release) called by FrontendController::initAttributes method is executed before check login operation is performed. It&#039;s useful if you want to skip the user check login operation for specific items setting to true the AppController::$skipCheck attribute. Note that the checkLogin method is called before beditaBeforeFilter.&lt;br /&gt;&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;beditaBeforeFilter&lt;/strong&gt; called by AppController::&lt;strong&gt;beforeFilter&lt;/strong&gt; method is executed before every action in the controller;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;beditaBeforeRender &lt;/strong&gt;called by&lt;strong&gt; &lt;/strong&gt;AppController::&lt;strong&gt;beforeRender &lt;/strong&gt;method is executed after controller action but before view is rendered.&lt;/li&gt;
&lt;li&gt;&lt;em style=&quot;color: grey;&quot;&gt;&lt;strong style=&quot;color: grey;&quot;&gt;beditaAfterFilter&lt;/strong&gt; (present from 3.1 release) called by AppController::afterFilter method is executed after the render is done. It&#039;s the last thing made by controller.&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In addition some specific callbacks are called if respective method exists. When a reserved word is found a callback &lt;strong&gt;[reservedWord]BeforeFilter&lt;/strong&gt; (&lt;em&gt;my_custom_methodBeforeFilter&lt;/em&gt;) is called before reservedWord method and another callback &lt;strong&gt;[reservedWord]&lt;/strong&gt;&lt;strong&gt;BeforeRender&lt;/strong&gt; (&lt;em&gt;my_custom_methodBeforeRender&lt;/em&gt;) is called soon after reservedWord method.&lt;/p&gt;
&lt;p&gt;Similar callbacks are handled in &lt;strong&gt;section&lt;/strong&gt; method using the section &lt;em style=&quot;color: grey;&quot;&gt;(and content from 3.1 release)&lt;/em&gt; nickname replacing &lt;em&gt;&quot;-&quot;&lt;/em&gt; with &lt;em&gt;&quot;_&quot;&lt;/em&gt; in method name, i.e. &lt;strong&gt;[section-nickname]&lt;/strong&gt;&lt;strong&gt;BeforeFilter&lt;/strong&gt; &lt;em style=&quot;color: grey;&quot;&gt;(and &lt;strong style=&quot;color: grey;&quot;&gt;[content-nickname]BeforeFilter&lt;/strong&gt; from 3.1 release)&lt;/em&gt; and &lt;strong&gt;[section-nickname]BeforeRender&lt;/strong&gt; &lt;em style=&quot;color: grey;&quot;&gt;(and &lt;strong style=&quot;color: grey;&quot;&gt;[content-nickname]BeforeRender&lt;/strong&gt; from 3.1 release)&lt;/em&gt;. In our example the callbacks will be &lt;em&gt;section_1BeforeFilter()&lt;/em&gt; and &lt;em&gt;section_1BeforeRender()&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;So you can define these callback methods in Pages Controller to customize punctually the way to find results and manipulate the &lt;code&gt;$section&lt;/code&gt; array before render view.&lt;/p&gt;
&lt;p&gt;In particular the &lt;strong&gt;[section-nickname]&lt;/strong&gt;&lt;strong&gt;BeforeFilter&lt;/strong&gt; callback can be used to set parameters and class attributes to put the section method in the condition to find the expected result. For example changing the &lt;code&gt;FrontendController::$sectionOptions&lt;/code&gt; attribute like you can see in the blog posts &quot;Customizing Frontend Applications&quot; part &lt;a title=&quot;Customizing Frontend Applications [part 1]: divide objects by type in a section&quot; href=&quot;/customizing-frontend-applications-part-1-divide-objects-by-type-in-a-section&quot;&gt;1&lt;/a&gt;, &lt;a title=&quot;Customizing Frontend Applications [part 2]: how to load only selected content in a section&quot; href=&quot;/customizing-frontend-applications-part-2-load-only-selected-content&quot;&gt;2&lt;/a&gt; and &lt;a title=&quot;Customizing Frontend Applications [part 3]: time for pagination&quot; href=&quot;/customizing-frontend-applications-part-3-time-for-pagination&quot;&gt;3&lt;/a&gt; you can page sections&#039; contents, group BEdita objects for type, etc... .&lt;/p&gt;
&lt;p&gt;Instead the &lt;strong&gt;[section-nickname]&lt;/strong&gt;&lt;strong&gt;BeforeRender&lt;/strong&gt; callback usually can be used to manipulate the $section array that is setted in section method (you can find it in $this-&amp;gt;viewVars[&quot;section&quot;]).&lt;/p&gt;
&lt;h1&gt;Recap&lt;/h1&gt;
&lt;p&gt;The frontend flow of a section/content request can be summarized in this way:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;browser request&lt;/li&gt;
&lt;li&gt;&lt;em style=&quot;color: grey;&quot;&gt;call &lt;strong style=&quot;color: grey;&quot;&gt;beforeCheckLogin&lt;/strong&gt; method (from 3.1 BEdita version)&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;call &lt;strong&gt;beditaBeforeFilter&lt;/strong&gt; method&lt;/li&gt;
&lt;li&gt;routing section/content method through &lt;strong&gt;route&lt;/strong&gt; method&lt;/li&gt;
&lt;li&gt;if exists call &lt;strong&gt;[section-nickname]BeforeFilter&lt;/strong&gt; method&lt;/li&gt;
&lt;li&gt;&lt;em style=&quot;color: grey;&quot;&gt;if exists and content is requested call &lt;strong&gt;[content-nickname]BeforeFilter&lt;/strong&gt; method (from 3.1 BEdita version)&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;recover section and content data by nickname&lt;/li&gt;
&lt;li&gt;if exists call &lt;strong&gt;[section-nickname]BeforeRender&lt;/strong&gt; method&lt;/li&gt;
&lt;li&gt;&lt;em style=&quot;color: grey;&quot;&gt;if exists and content is requested call &lt;strong style=&quot;color: grey;&quot;&gt;[content-nickname]BeforeRender&lt;/strong&gt; method (from 3.1 BEdita version)&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;call &lt;strong&gt;beditaBeforeRender&lt;/strong&gt; method&lt;/li&gt;
&lt;li&gt;render view&lt;/li&gt;
&lt;li&gt;&lt;em style=&quot;color: grey;&quot;&gt;call &lt;strong style=&quot;color: grey;&quot;&gt;beditaAfterFilter&lt;/strong&gt; method (from 3.1 BEdita version)&lt;/em&gt;&lt;/li&gt;
&lt;/ol&gt;</description><pubDate>Mon, 22 Feb 2010 17:38:12 +0100</pubDate><link>http://www.bedita.com/menu/blog/frontend-application-flow-and-callback-methods</link><guid>http://www.bedita.com/menu/blog/frontend-application-flow-and-callback-methods</guid></item><item><title>Customizing Frontend Applications [part 3]: time for pagination</title><description>Paginating items in a frontend application&lt;hr/&gt;&lt;p&gt;Paginating items in a frontend application&lt;/p&gt;&lt;hr/&gt;&lt;p&gt;The third episode of our &lt;em&gt;&quot;Customizing Frontend Applications&quot;&lt;/em&gt; saga will be focused on pagination. Sooner or later each web developer/designer working on a web site will have to deal with contents pagination.&lt;br /&gt;BEdita comes with an easy way to do it, allowing a default pagination setting for the entire frontend application and/or a specific one for each section you want.&lt;/p&gt;
&lt;p&gt;Once again we&#039;ll use the &lt;code&gt;FrontendController::$sectionOptions&lt;/code&gt; attribute, in particular we are interested in &lt;strong&gt;childrenParams&lt;/strong&gt; key.&lt;/p&gt;
&lt;p&gt;Overriding this class attribute in our PagesController we can set a default pagination for all our sections:&lt;/p&gt;
&lt;pre class=&quot;brush: php; first-line: 1; tab-size: 4; toolbar: false; &quot;&gt;protected $sectionOptions = array(
   &quot;showAllContents&quot; =&amp;gt; true,
   &quot;itemsByType&quot; =&amp;gt; false,
   &quot;childrenParams&quot; =&amp;gt; array(
      &quot;order&quot; =&amp;gt; &quot;title&quot;,
      &quot;dim&quot; =&amp;gt; 10,
      &quot;dir&quot; =&amp;gt; true
   )
); &lt;/pre&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;In this way we are saying to show 10 items for page sorted by title&lt;sup&gt;&lt;a href=&quot;#note1&quot;&gt;[1]&lt;/a&gt;&lt;/sup&gt; in ascendant mode. Set dir to false to reverse the order of items. The couple &lt;code&gt;&quot;page&quot; =&amp;gt; 1&lt;/code&gt; is implied but if you want to show your items starting from page 2 you can add it to childrenParams.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Change page, sort or page dimension is very very simple&lt;/strong&gt;. We can use the named params convention used by CakePHP, so&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;http://www.example.com/section-1/page:2&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;will switch automagically to page 2 and similary we can change the order&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;http://www.example.com/section-1/order:created&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;the order direction&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;http://www.example.com/section-1/dir:0&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;or several things at once&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;http://www.example.com/section-1/page:2/dir:0&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The only thing you can do it at this point is build your toolbar pagination and to do this you have a toolbar array available inside &lt;code&gt;$section&lt;/code&gt; array, for example:&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;pre class=&quot;brush: php; first-line: 1; tab-size: 4; toolbar: false; &quot;&gt;[&#039;toolbar&#039;] =&amp;gt; Array (
   [&#039;first&#039;] =&amp;gt; 1
   [&#039;prev&#039;] =&amp;gt; 1
   [&#039;next&#039;] =&amp;gt; 3
   [&#039;last&#039;] =&amp;gt; 5
   [&#039;size&#039;] =&amp;gt; 9
   [&#039;pages&#039;] =&amp;gt; 5
   [&#039;page&#039;] =&amp;gt; 2
   [&#039;dim&#039;] =&amp;gt; 2
   [&#039;start&#039;] =&amp;gt; 3
   [&#039;end&#039;] =&amp;gt; 4
)&lt;/pre&gt;
&lt;p&gt;&lt;code&gt; &lt;/code&gt;where:&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;first&lt;/strong&gt; is equal to 0 if we are in the first page&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;prev&lt;/strong&gt; is the previous page&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;next&lt;/strong&gt; is the next page&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;last&lt;/strong&gt; is the last page and is equal to 0 when we are in the last page&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;size&lt;/strong&gt; is the total number of items&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;pages&lt;/strong&gt; is the total number of pages available&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;page&lt;/strong&gt; is the current page number&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;dim&lt;/strong&gt; is the dimension of items for page&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;start&lt;/strong&gt; is the numeric position of first current page&#039;s item&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;end&lt;/strong&gt; is the numeric position of last current page&#039;s item&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;So you could build your own helper to show the pagination toolbar or you can use the &lt;a title=&quot;API doc&quot; href=&quot;http://api.bedita.com/classBeToolbarHelper.html&quot; target=&quot;_blank&quot;&gt;BeToolbar&lt;/a&gt; helper of BEdita core.&lt;/p&gt;
&lt;h1&gt;Change the default pagination for a section&lt;/h1&gt;
&lt;p&gt;As usual (if you read the previous articles &lt;a title=&quot;Customizing Frontend Applications [part 1]: divide objects by type in a section&quot; href=&quot;/blog/customizing-frontend-applications-part-1-divide-objects-by-type-in-a-section&quot; target=&quot;_self&quot;&gt;1&lt;/a&gt;-&lt;a title=&quot;Customizing Frontend Applications [part 2]: how to load only selected content in a section&quot; href=&quot;/blog/customizing-frontend-applications-part-2-load-only-selected-content&quot; target=&quot;_self&quot;&gt;2&lt;/a&gt;) you can change the default &lt;code&gt;$sectionOptions[&quot;childrenParams&quot;]&lt;/code&gt; attribute for a specific section thorugh out the &lt;strong&gt;section-nicknameBeforeFilter&lt;/strong&gt; callback.&lt;/p&gt;
&lt;p&gt;That&#039;s it.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;sup&gt;&lt;a name=&quot;note1&quot;&gt;&lt;/a&gt;[1]&lt;/sup&gt; Note that &quot;title&quot; is a field of &quot;objects&quot; table used by BEObject model, so if you want to be sure to avoid ambiguous fields you should specify the model field you want to order by i.e. &lt;/em&gt;&lt;code&gt;&quot;order&quot; =&amp;gt; &quot;BEObject.title&lt;/code&gt;&lt;em&gt;&lt;code&gt;&quot;&lt;/code&gt;. We&#039;ll see in other post how to filter the selection of items using &lt;strong&gt;&quot;filter&quot;&lt;/strong&gt; key in &lt;strong&gt;&quot;childrenParams&quot;&lt;/strong&gt;. This filter can be build using fields of other tables that can collide with BEObject fields.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;br /&gt;&lt;/em&gt;&lt;/p&gt;</description><pubDate>Mon, 22 Feb 2010 10:41:22 +0100</pubDate><link>http://www.bedita.com/menu/blog/customizing-frontend-applications-part-3-time-for-pagination</link><guid>http://www.bedita.com/menu/blog/customizing-frontend-applications-part-3-time-for-pagination</guid></item><item><title>Customizing Frontend Applications [part 2]: how to load only selected content in a section</title><description>Improve speed performance by narrowing your requests to the API&lt;hr/&gt;&lt;p&gt;Improve speed performance by narrowing your requests to the API&lt;/p&gt;&lt;hr/&gt;&lt;p&gt;While programming, you can request the content of a certain section by URL, with something like &lt;strong&gt;http://www.example.com/section-nickname/content-nickname&lt;/strong&gt;. The requested content is loaded into the &lt;code&gt;$section[&quot;currentContent&quot;]&lt;/code&gt; array, while more content – actually every content in the same section – is placed into the &lt;code&gt;$section[&quot;childContents&quot;]&lt;/code&gt; array. This additional content is loaded in &quot;&lt;em&gt;base level mode&quot;&lt;/em&gt; (cfr. the API manual, &quot;baseLevel&quot;), which means that only basic informations about various objects are given (such as the title, the description, its ID and a few more).&lt;/p&gt;
&lt;p&gt;Now this is indeed useful in standard scenarios: when you are showing a particular &lt;em&gt;content&lt;/em&gt; and listing, at the same time, related contents in the same section. Imagine you are showing an article and you want to put links to more contents in a contextual menu. This is common, but sometimes you are interested only in a single object, while you don&#039;t really need to load all related stuff.&lt;/p&gt;
&lt;p&gt;In these cases you can improve the data loading performance by excluding this additional content (you actually give up the option of having also &lt;code&gt;$section[&quot;childContents&quot;]&lt;/code&gt; array). Obviously the improvement will be much more evident when that particular section is burdened, it has got many objects inside.&lt;/p&gt;
&lt;p&gt;However, moving forward into the discussion started in the previous article &lt;a href=&quot;http://staging.bedita.com/blog/customizing-frontend-applications-part-1-divide-objects-by-type-in-a-section&quot; target=&quot;_blank&quot;&gt;&quot;Customizing Frontend Applications [part 1]: divide objects by type in a section&quot;&lt;/a&gt;, we&#039;re going to use the Frontend Controller attribute &lt;code&gt;$sectionOptions&lt;/code&gt;. This time too, &lt;strong&gt;we may proceed in two different ways, the choice depending on whether we want a custom behavior for a specific section (1) or alternatively we prefer to modify the default behavior for the whole frontend application (2)&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;So I&#039;m showing you both:&lt;/p&gt;
&lt;h2&gt;1. Custom behavior for a section&lt;/h2&gt;
&lt;p&gt;Like we did in the previous post, we are going to use the &lt;strong&gt;nicknameBeforeFilter&lt;/strong&gt; callback: It is automatically called before section data are loaded, so in the controller:&lt;/p&gt;
&lt;pre class=&quot;brush: php; first-line: 1; tab-size: 4; toolbar: false; &quot;&gt;protected function section-nicknameBeforeFilter() {
   $this-&amp;gt;sectionOptions[&quot;showAllContents&quot;] = false;
}&lt;/pre&gt;
&lt;p&gt;(pay attention to change &quot;section-nickname&quot; with the exact nickname of your section).&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;h2&gt;2. Change the default behavior&lt;/h2&gt;
&lt;p&gt;To change the way the API answers to requests, edit your Pages Controller. You have to change the &lt;code&gt;$sectionOptions&lt;/code&gt; attribute, by setting the &lt;span style=&quot;font-weight: bold; font-family: &#039;Courier New&#039;, Courier, monospace;&quot;&gt;showAllContents&lt;/span&gt; property to &lt;span style=&quot;font-style: italic; font-family: &#039;Courier New&#039;, Courier, monospace;&quot;&gt;false&lt;/span&gt;:&lt;/p&gt;
&lt;pre class=&quot;brush: php; first-line: 1; gutter: false; tab-size: 4; toolbar: false; &quot;&gt;protected $sectionOptions = array(
   &quot;showAllContents&quot; =&amp;gt; false, 
   &quot;itemsByType&quot; =&amp;gt; false, 
   &quot;childrenParams&quot; =&amp;gt; array()
);&lt;/pre&gt;
&lt;p&gt;When &lt;strong&gt;showAllContents&lt;/strong&gt; is set to &lt;strong&gt;false&lt;/strong&gt;, we say to the API not to load all related content when a specific content is requested.&lt;/p&gt;</description><pubDate>Fri, 27 Nov 2009 13:16:47 +0100</pubDate><link>http://www.bedita.com/menu/blog/customizing-frontend-applications-part-2-load-only-selected-content</link><guid>http://www.bedita.com/menu/blog/customizing-frontend-applications-part-2-load-only-selected-content</guid></item><item><title>Customizing Frontend Applications [part 1]: divide objects by type in a section</title><description>Organize your BEdita objects in $section array to have a semantic separation of contents.&lt;hr/&gt;&lt;p&gt;With this post we start a series of documents that explain how customize your frontend application for all your needs.&lt;/p&gt;&lt;hr/&gt;&lt;p&gt;In any &lt;em&gt;Frontend Application&lt;/em&gt; the standard organization of contents in a section reflects the backend visualization. So, supposing to have a section named &quot;section 1&quot; structured like in &lt;em&gt;figure 1&lt;/em&gt;, we&#039;ll have in frontend view the array &lt;code&gt;$section&lt;/code&gt; with different content types mixed together:&lt;/p&gt;
&lt;pre class=&quot;brush: php; first-line: 1; tab-size: 4; toolbar: false; &quot;&gt;Array(
   [&#039;id&#039;] =&amp;gt; section 1
   [&#039;nickname&#039;] =&amp;gt; section-1
   ...
   [&#039;childContents&#039;] =&amp;gt; Array(
      [0] =&amp;gt; Array(...),
      [1] =&amp;gt; Array(...)
      ...
   )
);&lt;/pre&gt;
&lt;p&gt;This is ok in many situation i.e. when I want to list contents in sequential order, but when I want contents to assume a specific behavior based on their semantic meaning this structure is limited.&lt;br /&gt;&lt;br /&gt;In every object array I have a key named &lt;strong&gt;object_type&lt;/strong&gt; that identify the type of the item (Document, Event, Gallery, etc...) so we can iterate the $childContents array and check that key to choose the right behavior. But this is not a good practice in some situations: for example if I want that in a 3 columns layout documents are shown in the first column, events in the second and galleries in the third column. Infact I should iterate the &lt;em&gt;childContents&lt;/em&gt; array three times. Another example could be this one: we don&#039;t know which types of objects are in a section but we want everyone to behave differently.&lt;/p&gt;
&lt;p&gt;In these cases the &lt;code&gt;$sectionOptions&lt;/code&gt; attribute of the FrontendController class helps us.&lt;/p&gt;
&lt;h3&gt;The first solution: semantic separation for all sections&lt;/h3&gt;
&lt;p&gt;In this first case we want in our frontend application the objects inside every section divided by type. To do this we will override the &lt;code&gt;$sectionOptions&lt;/code&gt; attribute in Pages Controller like this:&lt;/p&gt;
&lt;pre class=&quot;brush: php; first-line: 1; tab-size: 4; toolbar: false; &quot;&gt;class PagesController extends FrontendController {
   protected $sectionOptions = array(
      &quot;showAllContents&quot; =&amp;gt; true, 
      &quot;itemsByType&quot; =&amp;gt; true, 
      &quot;childrenParams&quot; =&amp;gt; array()
   );
   ...
} &lt;/pre&gt;
&lt;p&gt;setting &lt;strong&gt;itemsByType&lt;/strong&gt; to true we force BEdita objects inside a section to be divided by object type. Instead of &lt;strong&gt;&lt;em&gt;&quot;chidContents&quot;&lt;/em&gt; &lt;/strong&gt;we&#039;ll have &lt;strong&gt;&lt;em&gt;&quot;children&quot;&lt;/em&gt; &lt;/strong&gt;array:&lt;/p&gt;
&lt;pre class=&quot;brush: php; first-line: 1; tab-size: 4; toolbar: false; &quot;&gt;Array(
   [&#039;id&#039;] =&amp;gt; &#039;section 1&#039;,
   [&#039;nickname&#039;] =&amp;gt; &#039;section-1&#039;,
   ...
   [&#039;children&#039;] =&amp;gt; Array(
      [&#039;Document&#039;] =&amp;gt; Array(
         [0] =&amp;gt; Array(...),
         [1] =&amp;gt; Array(...)
      )
      [&#039;Event&#039;] =&amp;gt; Array(...)
      ...
    )
);&lt;/pre&gt;
&lt;p&gt; &lt;/p&gt;
&lt;h3&gt;The second solution: semantic division only for that section&lt;/h3&gt;
&lt;p&gt;In this case we&#039;ll use the &lt;strong&gt;nicknameBeforeFilter&lt;/strong&gt; callback called automatically before section data are loaded (note that &quot;-&quot; char in nickname is replaced with &quot;_&quot; in method name):&lt;/p&gt;
&lt;pre class=&quot;brush: php; first-line: 1; tab-size: 4; toolbar: false; &quot;&gt;protected function section_1BeforeFilter() {
   $this-&amp;gt;sectionOptions[&quot;itemsByType&quot;] = true;
}
&lt;/pre&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;The result will be an array like that above.&lt;/p&gt;</description><pubDate>Mon, 16 Nov 2009 12:08:24 +0100</pubDate><link>http://www.bedita.com/menu/blog/customizing-frontend-applications-part-1-divide-objects-by-type-in-a-section</link><guid>http://www.bedita.com/menu/blog/customizing-frontend-applications-part-1-divide-objects-by-type-in-a-section</guid></item><item><title>Embedding multimedia objects</title><description>An overview on the multimedia embedding feature, using the BeEmbedMedia Helper.&lt;hr/&gt;&lt;p&gt;An overview on the multimedia embedding feature, using the BeEmbedMedia Helper.&lt;/p&gt;&lt;hr/&gt;&lt;p&gt;The BeEmbedMedia helper is used to create and display every type of multimedia object as &lt;strong&gt;Video&lt;/strong&gt;, &lt;strong&gt;Audio&lt;/strong&gt;, &lt;strong&gt;Image&lt;/strong&gt;, &lt;strong&gt;Application&lt;/strong&gt; (like Flash object) or generic multimedia file (&lt;strong&gt;BEFile&lt;/strong&gt;). This helper is always included in backend AppController, as well as in every frontend application by inheritance, so inserting a video, a Flash swf file or an image is as easy as using a CakePHP helper. The helper uses &lt;a href=&quot;http://flowplayer.org&quot; target=&quot;_blank&quot;&gt;Flowplayer&lt;/a&gt; as internal flash player for native visualization of video and audio objects but also allow the embedding of provider players when there&#039;s no direct link to &lt;em&gt;flv&lt;/em&gt; file (i.e youtube see figure 1, 2). &lt;br /&gt;Let&#039;s see how:&lt;br /&gt;&lt;br /&gt;Essentially &lt;strong&gt;this helper provides a function called &quot;object&quot;&lt;/strong&gt; that works generically for any Bedita object:&lt;/p&gt;
&lt;pre class=&quot;brush: php; first-line: 1; gutter: false; tab-size: 4; toolbar: false; &quot;&gt;public function object ( $obj, $params = null, $htmlAttributes=array() )&lt;/pre&gt;
&lt;p&gt;&lt;br /&gt;The &lt;code&gt;$obj&lt;/code&gt; parameter represent the BEdita object that has to be displayed in the frontend. Generically in your view code, you&#039;ll have a multidimensional array:&lt;/p&gt;
&lt;pre class=&quot;brush: php; first-line: 1; gutter: false; tab-size: 4; toolbar: false; &quot;&gt;$section[&quot;currentContent&quot;][&quot;relations&quot;][&quot;attach&quot;]&lt;/pre&gt;
&lt;p&gt;&lt;br /&gt;which contains a list of all related media objects, i.e. all the media objects which share a &quot;&lt;strong&gt;relation&quot;&lt;/strong&gt; of type &quot;&lt;strong&gt;attach&quot;&lt;/strong&gt; with &lt;strong&gt;&quot;currentContent&quot;&lt;/strong&gt; inside the &lt;strong&gt;&quot;section&quot;&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;h2&gt;$params&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;$params&lt;/code&gt; represent an array of specific parameters related to the type of object to display. There&#039;s few parameters handled internally by BEdita. The main of those is &lt;strong&gt;&quot;presentation&quot;&lt;/strong&gt; params which define how the multimedia objects have to be shown. This parameter has a default value for any multimedia object so while for an image object will be create a thumbnail, for video object will be loaded the flash player.&lt;br /&gt;&lt;br /&gt;You can force presentation type passing the value in &lt;code&gt;$params&lt;/code&gt; associative array. It can be &lt;strong&gt;&quot;thumb&quot;&lt;/strong&gt; , &lt;strong&gt;&quot;full&quot;&lt;/strong&gt; or &lt;strong&gt;&quot;link&quot;&lt;/strong&gt;.&lt;br /&gt;For example, the code:&lt;/p&gt;
&lt;pre class=&quot;brush: php; first-line: 1; tab-size: 4; toolbar: false; &quot;&gt;{assign_associative var=&quot;params&quot; presentation=&quot;thumb&quot; width=200 mode=&quot;crop&quot;}
{foreach from=$section.currentContent.relations.attach item=&quot;media&quot;}
   {$beEmbedMedia-&amp;gt;object($media,$params)}
{/foreach}&lt;/pre&gt;
&lt;p&gt;Will try to show the contents of array &quot;attach&quot; with thumbnails, regardless of the specific object. For example in case of a video object, will display the associated thumbnail if present, while in case of an image stored on BEdita, will try to generate thumbnail runtime or reusing a thumbnail previously created. &lt;br /&gt;&lt;br /&gt;The &lt;strong&gt;&quot;presentation=full&quot;&lt;/strong&gt; type will display the full visualization of the object embedding directly the video or the audio or the images object.&lt;br /&gt;The code:&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;pre class=&quot;brush: php; first-line: 1; tab-size: 4; toolbar: false; &quot;&gt;{assign_associative var=&quot;params&quot; presentation=&quot;full&quot;}
{foreach from=$section.currentContent.relations.attach item=&quot;media&quot;}
   {$beEmbedMedia-&amp;gt;object($media,$params)}
{/foreach}&lt;/pre&gt;
&lt;p&gt;Will try to display the video and audio object type with the internal default player, if &lt;strong&gt;&quot;useProviderPlayer&quot;&lt;/strong&gt; variable is present in &lt;code&gt;$params&lt;/code&gt; the function will try to embed the object using directly the related provider player. The image object type will be shown in their real dimension using the original file uploaded.&lt;br /&gt;&lt;br /&gt;Moreover, &lt;code&gt;$params&lt;/code&gt; can contain object-specific parameters such as &lt;strong&gt;flashvar&lt;/strong&gt; variables for customize Flowplayer or, more generically, any type of variable that is required to displaying multimedia objects. &lt;br /&gt;For examples:&lt;/p&gt;
&lt;pre class=&quot;brush: php; first-line: 1; tab-size: 4; toolbar: false; &quot;&gt;{assign_associative var=&quot;clips&quot; autoPlay=true}
{assign_associative var=&quot;flashVars&quot; clip=$clips}
{assign_associative var=&quot;params&quot; flashvars=$flashVars}
{foreach from=$section.currentContent.relations.attach item=&quot;media&quot;}
    {$beEmbedMedia-&amp;gt;object($media,$params)}
{/foreach}&lt;/pre&gt;
&lt;p&gt;Enable the &lt;strong&gt;autoplay&lt;/strong&gt; function, when display a video with flowplayer.&lt;br /&gt;&lt;br /&gt;The &lt;strong&gt;&quot;presentation=link&quot;&lt;/strong&gt; parameter will produce a well formatted anchor pointing to the resource itself, with the title of the object inserted inside anchor tag.&lt;br /&gt;Finally the &lt;strong&gt;URLonly&lt;/strong&gt; parameter will force the helper to return only the URL, that can be useful when you want use manually the &lt;code&gt;&lt;img alt=&quot;&quot; /&gt;&lt;/code&gt; &quot;img&quot; tag.&lt;/p&gt;
&lt;pre class=&quot;brush: php; first-line: 1; tab-size: 4; toolbar: false; &quot;&gt;{assign_associative var=&quot;params&quot; presentation=link URLonly=true}
{foreach from=$section.currentContent.relations.attach item=&quot;media&quot;}
   &amp;lt; img src=&quot;{$beEmbedMedia-&amp;gt;object($media,$params)}&quot; alt=&quot;&quot; /&amp;gt;
{/foreach}&lt;/pre&gt;
&lt;h2&gt;$htmlAttributes&lt;/h2&gt;
&lt;p&gt;The &lt;code&gt;$htmlAttributes&lt;/code&gt; represents the html parameters of the embedding object. Here you can specify all the html attributes like &lt;code&gt;rel&lt;/code&gt;, &lt;code&gt;width&lt;/code&gt;, &lt;code&gt;height&lt;/code&gt;, &lt;code&gt;id&lt;/code&gt;, etc...&lt;/p&gt;
&lt;p&gt;These was just an overview of the main features of the BeEmbedMedia helper, you can try by yourself all options and eventually ask help on the official &lt;a href=&quot;http://forum.bedita.com&quot; target=&quot;_blank&quot;&gt;forum&lt;/a&gt;. Some useful links are reported in the right column.&lt;/p&gt;</description><pubDate>Mon, 28 Sep 2009 17:49:14 +0200</pubDate><link>http://www.bedita.com/menu/blog/embedding-media-object</link><guid>http://www.bedita.com/menu/blog/embedding-media-object</guid></item><item><title>BEdita shell: introducing command line tools</title><description>A collection of useful command line tools to execute simple tasks from shell&lt;hr/&gt;&lt;p&gt;A collection of useful command line tools to execute simple tasks from shell&lt;/p&gt;&lt;hr/&gt;&lt;p&gt;Command line tools are an important (and not well known) part of the BEdita framework.&lt;br /&gt;There are many commands available to accomplish many tasks:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;export or import a complete instance&lt;/li&gt;
&lt;li&gt;send notification mails or newsletter&lt;/li&gt;
&lt;li&gt;create a new BEdita instance&lt;/li&gt;
&lt;li&gt;check instance status&lt;/li&gt;
&lt;li&gt;remove cache and compiled templates&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;How do I use them?&lt;/h2&gt;
&lt;p&gt;There is a simple shell/batch script (cake.sh for Linux/Max/Unix cake.bat for Windows) to launch those tasks.&lt;br /&gt;Point to the root BEdita directory with the command line where you have bedita-app, bedita-db, cake, vendors directories.&lt;/p&gt;
&lt;p&gt;Under Linux or MacOSX (or other UNIX-like systems) type:&lt;/p&gt;
&lt;pre class=&quot;brush: bash; first-line: 1; tab-size: 4; toolbar: false; &quot;&gt;./cake.sh bedita help&lt;/pre&gt;
&lt;p&gt;&lt;code&gt; &lt;/code&gt;Under Windows:&lt;/p&gt;
&lt;pre class=&quot;brush: bash; first-line: 1; tab-size: 4; toolbar: false; &quot;&gt;cake.bat bedita help&lt;/pre&gt;
&lt;p&gt;&lt;code&gt; &lt;/code&gt;You will get some informations and usage hints regarding the main &lt;strong&gt;bedita&lt;/strong&gt; script.&lt;br /&gt;Now you can play with this script and discover what services it provides.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;To name a few (without cake.sh/bat):&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;bedita cleanup&lt;/code&gt; - cache and compiled templates cleanup&lt;/li&gt;
&lt;li&gt;&lt;code&gt;bedita export/import&lt;/code&gt; - exports or imports a complete BEdita instance&lt;/li&gt;
&lt;li&gt;&lt;code&gt;bedita modules&lt;/code&gt; - adds/removes instance modules&lt;/li&gt;
&lt;li&gt;&lt;code&gt;bedita checkApp&lt;/code&gt; - checks application status, missing config files, db connections, checks main URLs, paths and permissions on filesystem&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Besides the main script (&lt;strong&gt;bedita&lt;/strong&gt;) there are other BEdita shell tools available:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;&lt;strong&gt;dbadmin&lt;/strong&gt;&lt;/em&gt;: some methods to check/fix some db data, some to insert test objects&lt;/li&gt;
&lt;li&gt;&lt;em&gt;&lt;strong&gt;gettext&lt;/strong&gt;&lt;/em&gt;: parses views/php files, extracts i18n entries and updates .po files (gettext format)&lt;/li&gt;
&lt;li&gt;&lt;em&gt;&lt;strong&gt;mail&lt;/strong&gt;&lt;/em&gt;: sends notification mail and newsletters&lt;/li&gt;
&lt;li&gt;&lt;em&gt;&lt;strong&gt;migrate&lt;/strong&gt;&lt;/em&gt;: data migration scripts from previous BEdita versions&lt;/li&gt;
&lt;li&gt;&lt;em&gt;&lt;strong&gt;newsletter&lt;/strong&gt;&lt;/em&gt;: some newsletter related tools (data import)&lt;/li&gt;
&lt;/ul&gt;</description><pubDate>Wed, 22 Jul 2009 17:33:22 +0200</pubDate><link>http://www.bedita.com/menu/blog/bedita-shell-introducing-command-line-tools</link><guid>http://www.bedita.com/menu/blog/bedita-shell-introducing-command-line-tools</guid></item><item><title>How to manage free semantic relations</title><description>Define and customize relations between BEdita objects&lt;hr/&gt;&lt;p&gt;Define and customize relations between BEdita objects&lt;/p&gt;&lt;hr/&gt;&lt;p&gt;One of the most powerful features of &lt;strong&gt;BEdita&lt;/strong&gt; is the possibility to define and use &lt;em&gt;free semantic relations between objects&lt;/em&gt;. In this article I&#039;m going to show you how build and use them.&lt;/p&gt;
&lt;h1&gt;BEdita objects&lt;/h1&gt;
&lt;p&gt;&lt;strong&gt;BEdita is completely object-oriented, &lt;/strong&gt;so every element is an object with a specific &lt;strong&gt;object type&lt;/strong&gt;. The object type itself defines some particular behaviors like the possibility to be showed in a certain module, the possibility to stay in the tree structure and the way to relate with other object types. You can find the BEdita object types inside the table &lt;strong&gt;object_types&lt;/strong&gt; that contains &lt;em&gt;id&lt;/em&gt;, &lt;em&gt;name&lt;/em&gt; and &lt;em&gt;module&lt;/em&gt; fields. To create a new relations we&#039;ll use the &lt;em&gt;id&lt;/em&gt; of the object types.&lt;/p&gt;
&lt;h1&gt;Where do I define relations between objects?&lt;/h1&gt;
&lt;p&gt;The first thing to know is that these relations have to be defined in a configuration file, in particular in &lt;code&gt;bedita-app/config/bedita.cfg.php&lt;/code&gt;. You can find some default relations in &lt;code&gt;bedita-app/config/bedita.ini.php&lt;/code&gt; but this file shouldn&#039;t be touched (may be overwritten during an update of BEdita), so have a look at the relations in this file only as reference.&lt;/p&gt;
&lt;p&gt;In &lt;code&gt;bedita.cfg.php&lt;/code&gt; you can find the configuration variable:&lt;/p&gt;
&lt;pre class=&quot;brush: php; first-line: 1; gutter: false; tab-size: 4; toolbar: false; &quot;&gt;$config[&quot;objRelationType&quot;] &lt;/pre&gt;
&lt;p&gt;commented. Uncomment it and let&#039;s customize your relations.&lt;strong&gt;&lt;br /&gt;Choose a name&lt;/strong&gt; for your relations for example &lt;em&gt;&quot;speakers&quot;&lt;/em&gt;:&lt;/p&gt;
&lt;pre class=&quot;brush: php; first-line: 1; tab-size: 4; toolbar: false; &quot;&gt;$config[&quot;objRelationType&quot;] = array(
   &quot;speakers&quot; =&amp;gt; array()
);&lt;/pre&gt;
&lt;p&gt;In this way I&#039;m going to define a free relation named &lt;em&gt;&quot;speakers&quot;&lt;/em&gt; that can link all objects. Now go to &lt;strong&gt;Addressbook&lt;/strong&gt; module (this module use Card objects, as you can see in object_types table) and click on create &lt;em&gt;&quot;new card&quot;&lt;/em&gt;. Have a look at &lt;strong&gt;Relationship tab&lt;/strong&gt; and you can see that the new relation appears in it (&lt;em&gt;figure 1&lt;/em&gt;).&lt;br /&gt;&lt;br /&gt;Now you can click on &lt;em&gt;&quot;Connect new items&quot;&lt;/em&gt; button to link other objects to this one, change order of related objects by drag &amp;amp; drop (&lt;em&gt;figure 2&lt;/em&gt;) and then save the card to estabilish the relation.&lt;/p&gt;
&lt;p&gt;In this way we have defined the relation for all object types so if you look at other modules like Documents, Events, Galleries, etc... you&#039;ll find the &lt;em&gt;&quot;speakers&quot;&lt;/em&gt; relation in the &lt;strong&gt;Relationship tab&lt;/strong&gt;. But if I want that the relation is estabilished only between some objects, how can I do it?&lt;/p&gt;
&lt;h1&gt;Customizing a relation between some object types&lt;/h1&gt;
&lt;p&gt;Suppose that I have to manage a festival site. I can create all festival events thorugh &lt;strong&gt;Events module&lt;/strong&gt; and all people that partecipate to the festival through &lt;strong&gt;Addressbook module&lt;/strong&gt;. Some of this people will be speakers so I will have to associate the events to the cards of the speakers through the &lt;em&gt;&quot;speakers&quot;&lt;/em&gt; relation. I want to use my &lt;em&gt;&quot;speakers&quot;&lt;/em&gt; relation only to link events to cards, I don&#039;t want to see and to use this relation in Galleries module, for instance. Edit &lt;code&gt;$config[&quot;objRelationType&quot;]&lt;/code&gt; in this way:&lt;/p&gt;
&lt;pre class=&quot;brush: php; first-line: 1; tab-size: 4; toolbar: false; &quot;&gt;$config[&quot;objRelationType&quot;] = array(
   &quot;speakers&quot; =&amp;gt; array(
      &quot;left&quot; =&amp;gt; array(&quot;card&quot;),
      &quot;right&quot; =&amp;gt; array(&quot;event&quot;)
   )
);&lt;/pre&gt;
&lt;p&gt;Here I define that the &lt;em&gt;&quot;speakers&quot;&lt;/em&gt; relation is estabilished between some object types. On the left I have card objects and on the right I have event objects. Note that the order of the object types in &lt;em&gt;&quot;left&quot;&lt;/em&gt;, &lt;em&gt;&quot;right&quot;&lt;/em&gt; key is indifferent.&lt;br /&gt;&lt;br /&gt;In this way only in Events and Addressbook mdoules you can see &lt;em&gt;&quot;&lt;/em&gt;&lt;em&gt;speakers&lt;/em&gt;&lt;em&gt;&quot;&lt;/em&gt; in &lt;strong&gt;Relationship tab&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;If you want to use this relation for other object types it&#039;s enough add &lt;em&gt;ids&lt;/em&gt; to &lt;em&gt;&quot;left&quot;&lt;/em&gt; or &lt;em&gt;&quot;right&quot;&lt;/em&gt; key so, for example:&lt;/p&gt;
&lt;pre class=&quot;brush: php; first-line: 1; tab-size: 4; toolbar: false; &quot;&gt;$config[&quot;objRelationType&quot;] = array(
   &quot;speakers&quot; =&amp;gt; array(
      &quot;left&quot; =&amp;gt; array(&quot;card&quot;),
      &quot;right&quot; =&amp;gt; array(&quot;event&quot;,&quot;documents&quot;)
   )
);&lt;/pre&gt;
&lt;p&gt;With this definition I can associate documents and events from a card object and I can associate only cards from a document or an event object.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;h1&gt;One way relations&lt;/h1&gt;
&lt;p&gt;The relations are built in both directions by default, so I can see the association from both the objects involved. In some rare case I could desire that the relation were shown only in one direction. In these cases we can build a one way relation always editing &lt;code&gt;bedita.cfg.php&lt;/code&gt; file.&lt;/p&gt;
&lt;pre class=&quot;brush: php; first-line: 1; tab-size: 4; toolbar: false; &quot;&gt;$config[&quot;cfgOneWayRelation&quot;] = array(
   &quot;speakers&quot;, 
   &quot;other one way relation&quot;
);&lt;/pre&gt;
&lt;p&gt;Now if I create a &lt;em&gt;&quot;speakers&quot;&lt;/em&gt; relation from card to event I will see the relation inside the card object but I will not see it inside the event object.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;h1&gt;Relations in frontend&lt;/h1&gt;
&lt;p&gt;As explained in &lt;a href=&quot;http://bedita.com/bedocs/il-primo-frontend&quot;&gt;&quot;My first frontend&quot;&lt;/a&gt; you&#039;ll find the semantic relations between objects in an &lt;strong&gt;array named&lt;/strong&gt; &lt;strong&gt;&quot;relations&quot;&lt;/strong&gt; so for example in an event related with some card by &lt;em&gt;&quot;speakers&quot;&lt;/em&gt; relation I will have:&lt;/p&gt;
&lt;pre class=&quot;brush: php; first-line: 1; tab-size: 4; toolbar: false; &quot;&gt;[relations] =&amp;gt; Array (
[speakers] =&amp;gt; array( 
   0 =&amp;gt; card1, 
   1 =&amp;gt; card2, 
   ...
)&lt;/pre&gt;
&lt;h2&gt;At the end&lt;/h2&gt;
&lt;p&gt;At the end of this article you should be able to build your custom semantic relations between objects in simple or complex way to model your &lt;strong&gt;BEdita&lt;/strong&gt; instance according to your needs.&lt;/p&gt;</description><pubDate>Fri, 29 May 2009 18:08:58 +0200</pubDate><link>http://www.bedita.com/menu/blog/how-manage-free-semantic-relations</link><guid>http://www.bedita.com/menu/blog/how-manage-free-semantic-relations</guid></item><item><title>Hallo BEdita</title><description>The first public beta is here!&lt;hr/&gt;&lt;p&gt;After two years of hard work we are really pleased to announce  the first public beta release of BEdita 3 (pronounced [bi&#039;εdita]): a framework for Web2.0 applications that aims to be a standard tool in the next &lt;a title=&quot;Web 3.0&quot; href=&quot;http://www.scribd.com/doc/2021419/A-More-Revolutionary-Web-Print-Version-International-Herald-Tribune&quot; target=&quot;_blank&quot;&gt;Web3.0&lt;/a&gt; and in the future &lt;a title=&quot;Semantic Web&quot; href=&quot;http://www.w3.org/2001/sw/&quot; target=&quot;_blank&quot;&gt;Semantic Web.&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;As you may already know, the &lt;em&gt;beta &lt;/em&gt;is here &lt;a title=&quot;BEdita 3.0 - latest release&quot; href=&quot;http://www.bedita.com/be-download&quot; target=&quot;_self&quot;&gt;http://www.bedita.com/be-download&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;&lt;strong&gt;Framework or CMS?&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;&lt;a title=&quot;BEdita.com&quot; href=&quot;http://www.bedita.com&quot; target=&quot;_blank&quot;&gt;&lt;strong&gt;BEdita&lt;/strong&gt;&lt;/a&gt; shares many aspects with a  &lt;a title=&quot;CMS&quot; href=&quot;http://www.contentmanager.eu.com/history.htm&quot; target=&quot;_blank&quot;&gt;CMS (Content Management Systems)&lt;/a&gt;, often we call it that way for simplicity, in fact it follows its definition (at least in part): &lt;em&gt;a tool that enables technical and non technical staff to create, edit, manage and finally publish a variety of content (such as text, graphics, video, documents etc). &lt;/em&gt;But on the &lt;em&gt;publishing&lt;/em&gt; side it doens&#039;t have, &lt;em&gt;on purpose&lt;/em&gt;, a default unique and finished/ready solution.&lt;/p&gt;
&lt;p&gt;A good definition of &lt;a title=&quot;what is a framework?&quot; href=&quot;http://blog.newtonicaonline.com/2008/12/06/what-is-framework&quot; target=&quot;_blank&quot;&gt;software &lt;/a&gt;&lt;a title=&quot;what is a framework?&quot; href=&quot;http://blog.newtonicaonline.com/2008/12/06/what-is-framework&quot; target=&quot;_blank&quot;&gt;framework &lt;/a&gt;may help us understand things better: a &lt;em&gt;framework is &lt;/em&gt;&lt;em&gt;&lt;strong&gt;incomplete, &lt;/strong&gt;though concrete, &lt;strong&gt;driving solution &lt;/strong&gt;to recurring &lt;strong&gt;high-value &lt;/strong&gt;problem&lt;strong&gt;. &lt;/strong&gt;&lt;/em&gt;BEdita actually is:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;em&gt;incomplete&lt;/em&gt;– it&#039;s not a software that can solve needs/problems of a standard &lt;em&gt;user&lt;/em&gt;; instead it&#039;s a powerful tool for [web]designers/[web]developers to build &lt;em&gt;frontend &lt;/em&gt;applications;&lt;/li&gt;
&lt;li&gt;&lt;em&gt;driving 	solution to recurring high-value problem&lt;/em&gt; – it&#039;s useful in every situation where you may want to create applications (&lt;em&gt;frontend&lt;/em&gt;)&lt;em&gt; &lt;/em&gt;that handle complex multimedia contents and their semantic relations; for a designer/developer it prevents to challenge and solve typical annoying related issues. &lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;&lt;strong&gt;Architecture&lt;br /&gt;&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;Two are the main elements of the &lt;em&gt;semantic framework&lt;/em&gt;:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;a &lt;em&gt;backend &lt;/em&gt;Web application to manage contents and their semantic relations, with an innovative ergonomic user interface, providing an original chromatic association between object types, extensive use of drag&#039;n&#039;drop and other AJAX techniques; &lt;/li&gt;
&lt;li&gt;a frontend API, services and specifications to build frontend applications; mainly Web apps, but also desktop/mobile apps taking advantage of its native REST/XML interface. &lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The &lt;strong&gt;backend&lt;/strong&gt; application is unique and the same for every setup or instance, instead more &lt;strong&gt;frontend &lt;/strong&gt;applications can be built using an &lt;strong&gt;API &lt;/strong&gt;and inheriting from the core system&lt;strong&gt; Model classes and business logic layer&lt;/strong&gt;: they can be made of few lines of PHP code, or they can be much more complex. This separation is a choice made for security reasons, efficiency, scalability and to let maximum freedom to the designer/developer.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;</description><pubDate>Wed, 13 May 2009 16:33:28 +0200</pubDate><link>http://www.bedita.com/menu/blog/hallo-bedita</link><guid>http://www.bedita.com/menu/blog/hallo-bedita</guid></item></channel></rss><!-- 1.8171s -->