NetAssoBlog

200gr Web, a dash of marketing a hint of law ...
maxim

Tutorial - Template FLEXIcontent - Part2: field types

January 27

FLEXIcontent allows you to create custom fields for each type of content you want to use. This allows to force the user to enter different information in very specific areas that I can post later as I see fit. I can also turn these fields into search criteria or filter ... So with a little imagination, you can quickly make all templates that you want and once again open doors that close left Joomla.

liste_champs

The field types available are: checkbox, checkbox image, date, email, file, image, radio buttons, radio buttons picture, select, multiple select, text, textarea and weblink. Suffice to say that it lacks little to make you happy.

In addition to custom fields, FLEXIcontent also gives you access to additional features for each content:
- Version management
- An integrated system of voting
- Power stored favorites
- A hit counter
- Management of keywords
- Assigning multiple categories to a single content

All its features, that appear as fields, are automatically assigned to a content type when created and the database fields (title, description, author, creation date, modification date, publication status)

I will continue creating my template by configuring some typical fields and adding custom fields. This example is of course nothing concrete, he just intended to illustrate the various features.

Summary of tutorial:

  • General information fields FLEXIcontent
  • The typical fields
  • Custom fields and the use of plugins
  • Create your own field type
  • Position fields in the template

General information fields FLEXIcontent

FLEXIcontent in, you can associate a field with one or more types of content. Each has its own custom fields options. In fact the field types (textarea, checkbox, list ...) are generated through a specific plugin, so if you want nothing prevents you to create your own field type.
For each field types, there are some options that are common:

param_champs

  • Label: what is the name that will appear (or not) in front of your fields in the template. Beware if you want to change the label of the description field and want to differentiate according to the type of content, it is preferable at this time to change this value directly in settings where such an option is provided for this purpose.
  • Name: the name used to identify your fields, it is important to use only the characters AZ, az and 0-9 without spaces because it is the name that will allow us to reference our field in the template. By default when you create a field, called the FLEXIcontent "fieldxx" I urge you to change to get your bearings thereafter.
  • Posted: enables or not a field. Some fields (title, description, created, created by, last modified, revised by) can not be dépubliés because they are necessary for the proper versioning. However there is a trick if you do not want them to appear when creating new content, just do not affect the fields to the content type in question and our problem is solved.
  • Search: Indicates whether the contents of the fields will be indexed for a search or not.
  • Advanced Search: This function will be used from version 1.7 FLEXIcontent which is scheduled for the end of March.
  • Filter: Indicates whether the fields will be displayed as a filter in the display mode content category. If you want to use this feature you must initially set the value to yes on the fields that you will filter. Caution! only the fields with predefined values ​​(Checkbox, Checkbox image, Select, Select Multiple, Radio, Radio Image) can be used as a filter. Then do not forget to activate the filters within the parameters of the category and select from the list the appropriate fields.
  • Access Level: The level of access to fields, basic levels related to the Joomla ACL.
  • Order: Determines the display order of fields when entering content.
  • Description: Specifies the user instructions for entering the field. In the same way as for the label, if you want to learn different descriptions for the "description" field, you will learn in the type parameters.
  • Type: Select here the types you want associated with your field (press Ctrl to select multiple types)
  • Show Label: Allows you to enter a parameter that can be used in the template to determine whether or not it displays the field label.
  • Prefix and suffix: Available in most fields (but not all). These two parameters allow you the ability to add value before and after the contents of your fields. You can add for example the € symbol suffix if you want to display a currency field. They can be used also to add html code or even use them to implement a plugin (to see the last part of this tutorial)
  • Specific plugins: This list shows all content plugins installed on your Joomla site, you can choose specific plugins in the list or leave blank to make the content compatible with any plugin. This feature is useful in some cases to avoid conflicts, multiple displays or reduce load. Keep in mind that when the plugin is used on a field, will automatically run on all fields in the loop.

The typical fields

Some fields are automatically assigned when creating a new type, these are the types of fields FLEXIcontent.

Some are directly related to the Joomla core:

  • Title: The title of your content
  • Description: What is the content of your article in Joomla. If you want to make compatibility with Joomla content plugins, it will not take you forget to check in the settings of this box the option "Execute content plugins".
  • * Created: Date the content.
  • Created by: Author content.
  • Last modified *: Date of last modification of the content.
  • Revised by: Name of user who last modified the content.
  • Hits: Number of times the content has been posted. (By default it has a suffix of information: "views")
  • Document type: The type of content.
  • Version: The version of the content.
  • State: The state of publishing content.

* For the date fields, it is possible to change the display format in the settings of the field through a list of predetermined values ​​or create a custom display format using the settings of PHP strftime ( http :/ / php.net / manual / en / function.strftime.php ).

Other fields correspond to very specific features of FLEXIcontent:

  • Voting: evaluation Functionality to evaluate from January to May content. Voting is symbolized by an image 25 × 75 (com_flexicontent / assets / images / star.gif) divided into three sub-images representing the Shares: No selected, selected, and hover. You can create your own image, then change the path in the settings fields to point the path to your file. So I realize my little picture with balloons, it's more fun to assess stages. You can also change the display size of the image defaults to 16 pixels.
  • Favourites: heart_add Allows a registered user to rank this page in his favorites.
  • Categories: Stores the categories in which the content is classified. An option to select the separator that will be shown later in frontend (vertical bar, line break, comma, space)
  • Tags: Stores tags in which the contents are classified. An option to select the separator that will be shown later in frontend (vertical bar, line break, comma, space)

Custom Fields

As I stated previously FLEXIcontent offers us many possibilities to customize the entry display their content but also through custom fields. I will now, while resuming my example of creating a template to present the stages of French football, you have different types of custom fields. I would not use the fields for each set of parameters available, but through the entire tutorial I will cover all the features available.
Remember for each field to select the types affected in our type "Stadium".

  • Text:

I'll start by adding my first custom field, I want to display the address of the stadium. But that's not all I'm going to enjoy using the address you entered to display the location of my stage GoogleMap.
First of all I have installed and activated the latest version of the plugin GoogleMap ( http://www.kksou.com/php-gtk2/Joomla-Gadgets/googleMaps-plugin.php # download ).
I add my fields with the following values:

param_premier_champ

I called the label and the field name "address", then I select my field type: "Text". I complete my description telling the user how it should inform the content "Enter the address of the stadium with the following format: 'street number' 'street name', 'city'."
I want to run the GoogleMap plugin on that field, so I change the value of "Execute content plugins" indicating the value "yes".
I take my prefix in the beginning of the tag of my GoogleMap plugin: {addr = googleMaps "
Then the suffix I close my beacon and I add some plugin specific parameters: "width = 100 height = 190% = lang = en maptype G_HYBRID_MAP}
The address that I can enter later will be integrated directly as a parameter for my plugin.
Important! So far it is not possible to use a plugin that uses the pipe character "|" in the settings because it generates a bug.

  • Textarea

I will now add an area that will allow me to enter additional address with the following values:

param_deuxieme_champ

I decide not to activate the HTML editor and I reduce the area to five lines in order not to overload my entry page. (The area "Height of the publisher" only corresponds to the pixel height of the HTML editor)

  • Date

I will now add the field to record the date of inauguration of the stadium. This field will allow me to choose a date through a calendar that is displayed beside my fields dynamically.

param_troisieme_champ

I want a display format that does not exist in the list, so I select "Custom Size" and I take my format: "% d /% m /% Y" to display a date which will look like this' 14 / 07/1979 '. I also disables multiple values.

  • E-mail

I'll add a zome email that I can understand the different contact addresses.
param_champ_email I called my field "contact", I indicate instructions entered in the description. I will allow multiple values ​​with a maximum of 5 contacts. I also decided to display the values ​​in my template, separating by a comma.
Beware, there is no format control when entering values, the user can enter what they want (ie something other than email address). In the template, FLEXIcontent will simply add a "mailto:".

  • Weblink

I want to display for each of my stage name and the official club website playing on the lawn.
param_champ_weblink
I called my field "site_stade" and I said in the description should not enter the "http://" in my address. (Although we will see later that automatically manages the FLEXIcontent) I enlarged a bit the size of my field as a web address will take a little more room.
I also use the title of my link, instead of displaying the website address. This will allow me to show the name of the club rather than the name of its site.
Finally I do not want the user leaves my site if they click on link, so I sent in a new window.

  • Image

I will now add an image field in order to view a picture of my internship. I take the following parameters:
param_champ_image

I called my field "image_stade" I then informs the description by saying that I only allow jpg and png files. I decide not to display the field label, as for an image that is supposed illustrated my page I do not see the point.
I shows the types allowed extensions, beware it is important to enter the extension in lowercase and uppercase. I limit my maximum file size to 500KB (500,000 bytes).
Thumbnail quality is the rate of compression, not working on a large amount of image I prefer to maintain a good quality (possible value 1 -> 100)
I change the path to thumbnails directory to centralize all my images later in the same directory for FLEXIcontent, I can specify images / FLEXIcontent / thumbnails
We have the ability to manage a watermark (image embedded in the original image to ensure the rights of use), so I will exploit it. I leave the opacity to 100% because I will directly manage the transparency in my image file. I position my watermark in the bottom right.
FLEXIcontent will automatically generate three types of thumbnails when uploading our image. We can then use later in our templates different image sizes and therefore optimize load times.
For each size I set my maximum width and height. For large and medium-miniature, I let the image scale and I decided to embed my own watermarks that I store at the following location: images / FLEXIcontent / core / watermark.png. watermark
For my little miniature I would not use the watermark to the small size of my image.
Finally it is also possible to automatically link my Mini with my original image via a popup will appear automatically in my template. You can choose between the effect Rockbox or multibox.

  • Queue

I now want to add an area where I could make available various resources on the stage: plan forums, available services, brochures ... so I add my zone type "file" which I call "resources".
param_champ_file
This area will allow me to add multiple files automatically. Choose the type of separator between different files.
"Use MIME icon 'allows you to display on the frontend a small icon in front of the filename which depend directly on the MIME type of your file.
"Use a download button", this allows you to display a "Download" button rather than a link to the file. The concern is that if I activate this feature, I could not manage a file so it does not interest me.

  • Select

For each stage I want to associate the music played during the entrance of the players on the pitch. I will use a list that will directly depend FLEXIcontent files. Beforehand, I make some changes in the general settings of FLEXIcontent, I authorize the upload mp3 files and then I change the upload path "images / FLEXIcontent / files /". Can I install the plugin JosDewPlayer that will allow me to read the mp3 files correctly.
param_champ_select I called my field "anthem". I activate the plugin execution on the content and I select only josdewplayer to optimize the operation.
I also enable the removal of spaces in names to avoid errors in the file address.
To set up reading my file, I prefix information: {play} images / FLEXIcontent / files /, then suffix {/ play}
I want to use SQL to inform my list directly from files FLEXIcontent. I fill my sql query:

  A
 2
 3
  value , filename AS text SELECT value AS filename, filename text AS
 FROM AS fi # __flexicontent_files
 ext = "mp3" AND fi . published = 1 WHERE fi. Ext = "mp3" AND fi. Published = 1 

Must perform a query with two fields to display that must necessarily associate the alias "value" and "text" which of course corresponds to the value and the text of the list. Be aware that the default value that will be returned when viewing the template will be "text". I filter the files by selecting only the mp3 that are published.

  • Select multiple

I wish to associate and display the various partners of the club. I set up a "multiple select" to be associated with the component of banners in Joomla so you can select multiple partners. I called my field "partners"
param_champ_multiple I will use a plugin to display my banner, I do not forget to run even the content plugins and I select my plugin " Mos Banner 0.4 "previously installed. I delete the spaces. I take my tags prefix "mosbanner {: id =" then my suffix "}".
I will link the list to the list of Joomla banner published, so I turn and I go on my SQL query:

  A
 2
 3
 4
  value , name AS text SELECT BID AS value, name AS text
 AS FROM # __banner ba
 showBanner = 1 WHERE ba. ShowBanner = 1
 name ORDER BY ba. Name 


Finally I select comma-separated values ​​because it is the character used by my plugin.
We will see later that the result is not really one you want, and I have to create my own field type (see next section)

  • Checkbox, Checkbox picture, radio buttons and radio buttons picture

These fields are managed in the same way apart from the fact that in some we may add images.
I will select the "Checkbox picture" and learn the elements in the format
"Value label :: :: image%%", my values, "drink :: Drinks :: wc :: boissons.gif%%%% wc.gif Toilets :: restaurant :: Restaurants ::%% resto.gif Parking Parking parking.gif :: ::%% :: smoking :: Smoking Ban fumer.gif "
Do not put the double percentage at the end of the list.
param_champ_checkbox I then modified the path to my images "images / FLEXIcontent / core /". It is also possible to check the default values, using the default. It suffices to capture the "values", separated by commas.

My custom fields are now complete.

liste_champs_persos

Create your own field type

FLEXIcontent allows you to create your own field types, we can imagine doing such a field with an incremental counter (+, -) or even a scroll to determine values. I'll just present the possibilities for me because I'll just make a copy of "select multiple" to transform the rendering which is currently in this form: In this new format ... I want: [prefixe_plugin] [value1] [separator] [value2] [separator] ... [suffixe_plugin]

A field type in FLEXIcontent is actually a plugin, plugins are automatically installed in the plugins / flexicontent_fields / and consist of two files [nom_plugin]. Xml [nom_plugin]. Php and language files associated.

The XML file

I then made a copy of the original selectmultiple.xml I renames selectmultiple.php. This file is a standard Joomla installation, there is first the legal and description, I just amends the name of my plugin to distinguish the original plugin, I added at the author and I will update the version:

  A
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
  encoding = "utf-8" ?> <? Xml version = "1.0" encoding = "utf-8"?>
 type = "plugin" group = "flexicontent_fields" method = "upgrade" > <install "1.5" version = type = group = "plugin" "flexicontent_fields" "upgrade" method =>
  <name> Select Multiple Advanced </ name>
  <author> Emmanuel Danan, Maxime update Danjou (NetAssoPro) </ author>
  <creationDate> March 2009 </ creationDate>
  <copyright> Copyright (C) 2009 Emmanuel Danan </ copyright>
  <license> GNU / GPL v2 </ license>
  <authorEmail> emmanuel@vistamedia.fr </ authorEmail>
  <authorUrl> www.vistamedia.fr </ authorUrl>
  <version> 1.1 </ version>
  <description> FLEXI_FIELD_SELECTMULTIPLE </ description> 

I indicates the file name of my plugin:

  12
 13
 14
  <Files>
  > selectmultiplead.php </filename > <filename "selectmultiplead" plugin => selectmultiplead.php </ filename>
 </ Files> 

We then find the plugin parameters. I add two parameters, the first I call "postext_mode" that will allow me to say if we use the prefix and suffix of each value, or only the beginning and end of all values. My second parameter "value_mode" determines whether I will display my values ​​or my labels.

  15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57

Dans la dernière partie du fichier xml, je charge mes fichiers langues (qui ne sont également qu'une copie des originaux), je rajoute dans chacun de mes fichiers les variables suivantes : FLEXI_FIELD_VALUE_MODE, FLEXI_FIELD_VALUE_MODE_DESC, FLEXI_FIELD_VALUE, FLEXI_FIELD_POSTEXT_MODE, FLEXI_FIELD_POSTEXT_MODE_DESC.

  58
 59
 60
 61
 62
 <languages >
 <language tag = "en-GB" > en-GB.plg_flexicontent_fields_selectmultiplead.ini </language >
 <language tag = "fr-FR" > fr-FR.plg_flexicontent_fields_selectmultiplead.ini </language >
 </languages >
</install > 

Le fichier PHP

Le fichier est une classe composé de 5 événements :

  • onDisplayField : Affichage du champ dans la saisie du contenu
  • onDisplayFieldValue : Affichage du champ formaté pour le frontend
  • onBeforeSaveField : Formate la valeur du champ avant qu'elle soit enregistré
  • onAfterSaveField : N'est pas encore utilisé pour le moment, mais dans un futur proche il permettra d'effectuer des interactions avec les autres composants.
  • onDisplayFilter : Affiche les filtres dans la vue du template catégorie. Par défaut c'est des listes.

Je vais pour ma part uniquement modifier l'événement onDisplayFieldValue pour rajouter les conditions qui dépendent de mes 2 nouveaux paramètres.
Je commence par modifier le nom de ma classe et mon constructeur que je nomme : plgFlexicontent_fieldsSelectmultiplead.
Puis ensuite dans la première ligne de chaque événement, je modifie le code de la manière suivante :

  A
 if ( $field -> field_type != 'selectmultiplead' ) return ; 

Je rajoute donc les conditions dans mon code et j'enlève également les &nbsp; dans mes séparateurs afin de ne pas créer de bug avec mon plugin.

  A
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 function onDisplayFieldValue ( & $field , $item , $values = null , $prop = 'display' )
  {
  // execute the code only if the field type match the plugin type
  if ( $field -> field_type != 'selectmultiplead' ) return ;
  $values = $values ? $values : $field -> value ;
  // some parameter shortcuts
  $remove_space = $field -> parameters -> get ( 'remove_space' , 0 ) ;
  $pretext = $field -> parameters -> get ( 'pretext' , '' ) ;
  $posttext = $field -> parameters -> get ( 'posttext' , '' ) ;
  $field_elements = $field -> parameters -> get ( 'field_elements' , '' ) ;
  $sql_mode = $field -> parameters -> get ( 'sql_mode' , 0 ) ;
  $separatorf = $field -> parameters -> get ( 'separatorf' ) ;
  $opentag = $field -> parameters -> get ( 'opentag' , '' ) ;
  $closetag = $field -> parameters -> get ( 'closetag' , '' ) ;

  // j'ajoute mes deux nouveaux paramètres
  $value_mode = $field -> parameters -> get ( 'value_mode' , '' ) ;
  $postext_mode = $field -> parameters -> get ( 'postext_mode' , '' ) ;

  // je retire dans les séparateurs le &nbsp;
  switch ( $separatorf ) {
   case 0 :
    $separatorf = '&nbsp;' ;
    break ;
   case 1 :
    $separatorf = '<br />' ;
    break ;
   case 2 :
    $separatorf = '|' ;
    break ;
   case 3 :
    $separatorf = ',' ;
    break ;
   case 4 :
    $separatorf = $closetag . $opentag ;
    break ;
  default :
   $separatorf = '&nbsp;' ;
   break ;
  }
  if ( $pretext ) {
   $pretext = $remove_space ? $pretext : $pretext . ' ' ;
  }
  if ( $posttext ) {
   $posttext = $remove_space ? $posttext : ' ' . $posttext ;
  }
  if ( $sql_mode ) { // SQL mode
   $db = & JFactory :: getDBO ( ) ;

   $query = preg_match ( '#^select#i' , $field_elements ) ? $field_elements : '' ;
   $db -> setQuery ( $query ) ;
   $results = $db -> loadObjectList ( ) ;

   if ( ! $results ) {
    $field -> { $prop } = '' ;
   } else {
    $display = array ( ) ;
    foreach ( $results as $result ) {
     for ( $n = 0 , $c = count ( $values ) ; $n < $c ; $n ++ ) {
      if ( $result -> value == $values [ $n ] ) {
       // selon qu'on décide d'afficher la valeur ou l'étiquette
       if ( $value_mode == 0 ) {
        $thevalue = $result -> text ;
       } else {
        $thevalue = $result -> value ;
       }
       // selon qu'on décide d'utiliser le plugin pour toutes les valeurs ou pour l'ensemble des valeurs
       if ( $postext_mode == 0 ) {
        $display [ ] = $pretext . $thevalue . $posttext ;
       } else {
        $display [ ] = $thevalue ;
       }
      }
     }
    }
   }
  } else { // Elements mode
   // initialise property
   $listelements = explode ( " %% " , $field_elements ) ;
   $listarrays = array ( ) ;
   foreach ( $listelements as $listelement ) {
    $listarrays [ ] = explode ( "::" , $listelement ) ;
   }
   $display = array ( ) ;
   foreach ( $listarrays as $listarray ) {
    for ( $n = 0 , $c = count ( $values ) ; $n < $c ; $n ++ ) {
     if ( $values [ $n ] == $listarray [ 0 ] ) {
      // selon qu'on décide d'afficher la valeur ou l'étiquette
      if ( $value_mode == 0 ) {
       $thevalue = $listarray [ 1 ] ;
      } else {
       $thevalue = $listarray [ 0 ] ;
      }
      // selon qu'on décide d'utiliser le plugin pour toutes les valeurs ou pour l'ensemble des valeurs
      if ( $postext_mode == 0 ) {
       $display [ ] = $pretext . $thevalue . $posttext ;
      } else {
       $display [ ] = $thevalue ;
      }
     }
    }
   }
  }
  $field -> { $prop } = implode ( $separatorf , $display ) ;
  // selon qu'on décide d'utiliser le plugin pour toutes les valeurs ou pour l'ensemble des valeurs
  if ( $postext_mode == 1 ) {
   $field -> { $prop } = $pretext . $field -> { $prop } . $posttext ;
  }
  $field -> { $prop } = $opentag . $field -> { $prop } . $closetag ;
 } 

// some parameter shortcuts
$remove_space = $field->parameters->get('remove_space', 0) ;
$pretext = $field->parameters->get('pretext', ») ;
$posttext = $field->parameters->get('posttext', ») ;
$field_elements = $field->parameters->get('field_elements', ») ;
$sql_mode = $field->parameters->get('sql_mode', 0) ;
$separatorf = $field->parameters->get('separatorf') ;
$opentag = $field->parameters->get('opentag', ») ;
$closetag = $field->parameters->get('closetag', ») ;
$value_mode = $field->parameters->get('value_mode', ») ;
$postext_mode = $field->parameters->get('postext_mode', ») ;
switch ($separatorf) {
case 0:
$separatorf = '&nbsp;';
break;
case 1:
$separatorf = '<br />';
break;
case 2:
$separatorf = '|';
break;
case 3:
$separatorf = ',';
break;
case 4:
$separatorf = $closetag . $opentag;
break;
default:
$separatorf = '&nbsp;';
break;
}

if ($pretext) {
$pretext = $remove_space ? $pretext : $pretext . ' ';
}
if ($posttext) {
$posttext = $remove_space ? $posttext : ' ' . $posttext;
}
if ($sql_mode) { // SQL mode
$db = &JFactory::getDBO();

$query = preg_match('#^select#i', $field_elements) ? $field_elements : »;
$db->setQuery($query);
$results = $db->loadObjectList();

if (!$results) {
$field-> {
$prop} = »;
Else {}
$display = array();
foreach($results as $result) {
for($n = 0, $c = count($values); $n < $c; $n++) {
if ($result->value == $values[$n]) {
if ($value_mode == 0) {
$thevalue = $result->text ;
Else {}
$thevalue = $result->value ;
}
if ($postext_mode == 0) {
$display[] = $pretext . $thevalue . $posttext;
Else {}
$display[] = $thevalue ;
}
}
}
}
}
} else { // Elements mode
// initialise property
$listelements = explode( »%% « , $field_elements);
$listarrays = array();
foreach ($listelements as $listelement) {
$listarrays[] = explode( »:: », $listelement);
}

$display = array();
foreach ($listarrays as $listarray) {
for($n = 0, $c = count($values); $n < $c; $n++) {
if ($values[$n] == $listarray[0]) {
if ($value_mode == 0) {
$thevalue = $listarray[1];
Else {}
$thevalue = $listarray[0];
}
if ($postext_mode == 0) {
$display[] = $pretext . $thevalue . $posttext;
Else {}
$display[] = $thevalue ;
}
// end of modification
}
}
}
}
$field-> {$prop} = implode($separatorf, $display);
if ($postext_mode == 1) {
$field-> {$prop} = $pretext . $field-> {$prop} . $posttext;
}
$field-> {$prop} = $opentag . $field-> {$prop} . $closetag;
}

Une fois toutes mes modifications effectuées je n'ai plus qu'à créer mon fichier zip afin de réaliser le package de mon plugin que je pourrais installer via Joomla.
Vous pouvez télécharger l'exemple que j'ai réalisé ici : plg_flexicontent_selectmultiplead .

Je vais donc changer maintenant mon type de champ pour mon champ « partenaires » afin de lui affecter mon nouveau type : « Select Multiple Advanced ». Au niveau des options pour « Type d'information à afficher (frontend) », je sélectionne « valeur », puis pour « Multi Suffixe, préfixe » je le laisse sur « non ».

Positionner les champs dans le template

Dans ce dernier chapitre de la 2ème partie du tutoriel de la créations de template sous FLEXIcontent, je vais vous montrer comment positionner ses champs dans son propre template via l'interface du back office.

Je me rends dans la section Template de FLEXIcontent puis au niveau de la ligne de mon template « Stade » je clique sur l'icône associé à la Vie Item.

Le positionnement des champs se fait alors par un simple glisser/déposer. Je met en place mes champs de la manière suivante :

template_zone Dans une prochaine version de FLEXIcontent il sera également possible de créer ses propres zones directement via l'interface graphique… plutôt intéressant.

Je vous montrerez également dans la quatrième partie de ce tutoriel comment insérer des champs fixes directement dans le template.

That's all for this time in the next part I will touch on the part of the creation of content through our custom type . This will allow you to preview the layout of different fields and their entry mode.

Category: Web

Comments

On 27/01/2010 at 20:51, NetAssoBlog | Tutorial - Template FLEXIcontent - Part1: structure said:

NetAssoBlog | Tutorial - Template FLEXIcontent - Part1: structure

[...] Part2: The types of field available to create a template [...]

On 21/02/2010 at 11:55 AM, Chick said:

chick

Hello, sorry but I can not find mosbanner 0.4 for joomla 1.5. Thank you for giving me an info please!

On 21/02/2010 at 14:11, chick said:

chick

First, thank you for this great tutorial, although I do not understand everything and I do not know yet what I can do with FLEXIcontent lol, and thank you for your answer, but when you pull the zip is the Version 3 mosbanner which is not compatible joomla 1.5?! snifffff exist'il a solution?

On 24/02/2010 at 09:53 AM, Maxim said:

maxim

Oops you're right because the link was changed in the meantime. I just changed my article to redirect the link to version 0.4 MosBanner.
Everything falls into place

On 24/02/2010 at 15:53, chick said:

chick

Thank you very much for your response and your great work.

On 16/03/2010 at 15:04, Olivier said:

Olive

Hello Maxime,
I try to make my image field reference to a web page not the popup multibox: is it feasible?
Thank you
Olive

On 16/03/2010 at 15:50, Maxim said:

maxim

If it is for a fixed url, there have no worries. Just so that you put in your prefix your fields:
<A href = 'http://www.tonurl.com'>
and suffix:
</ A>

On 16/03/2010 at 16:05, Olivier said:

olive

ok thank you!

but if the url varies according to the picture: that is, a picture = reference to a web site committed to the inclusion of the photo??

brief so that the user does not touch the code ...

A big thank you

Olive

On 16/03/2010 at 17:09, Maxim said:

maxim

Well at that time must you add your type in a text field that you can call "mon_lien" example in your template and then you put this code here:
<? Php
echo "<a href = '". $ This-> fields ['mon_lien'] -> value [0]. "'>";
echo $ this-> fields ['mon_image'] -> display;
echo "</ a>";
?>

On 22/03/2010 at 22:03, Olivier said:

olive

thank you Maximus
I followed your instructions but in fact 'mon_lien' will stick following the link of the current page with the quotes ... it gives for example:
http://www.monsite.fr/ 'mon_lien'
I missed something??
thank you again
Olive

On 22/03/2010 at 22:52, Olivier said:

olive

it's good I found ... I reversed the "by" and "by" and it works :)
thank you
Olive

On 14/04/2010 at 23:35, Fred said:

Fred

Thank you for this tutorial is really well detailed and it allows me to understand many things to try to give me a hand with this great tool ^ ^

Small question about the XML file to create the plugin, when I read "I did so a copy of the original selectmultiple.xml selectmultiple.php I renamed it to" I guess you have to rename it and not selectmultiplead.xml in selectmultiple.php? is that right?

If not quite the walk, I'll even be able to use it on my site

On 14/04/2010 at 23:45, Fred said:

Fred

Another quick question:
I will now change my field type field for my "partners" to assign my new type: "Select Multiple Advanced". In terms of options for "Type of information to display (frontend)," I select "value" and for "Multi suffix, prefix" Leave it on "no"

I took your plugin directly and installed it.
I have the options:
- FLEXI_FIELD_POSTEXT_MODE (yes or no)
- FLEXI_FIELD_VALUE_MODE (label or FLEXI_FIELD_VALUE)
- Start tag
- Closing tag
Is this normal? or I missed something?

On 24/05/2010 at 13:45, alfred said:

alfred

Hello,
Firstly thank you for this component that helps us bcp at content management.
I have a class that contains articles, I created a link to this category in BLOG.
a lead article and other apparaient in two columns.
Please inform me how to resize images of items (it gives me a size of 150/150). I want to allocate 78/90 as image size for the items in columns 2 and 140/165 for the main section.
Meric bcp advance

On 15/07/2010 at 05:52, greg said:

greg

Hello,

I tried to automate the fields using a plugin (such weather) to enter in the Default fields ['capital'] -> display;?> But it does not work | -)
Is this a mistake on my part or is it totally impossible to do something like that?

Thank you in advance for your help

On 15/07/2010 at 05:55, greg said:

greg

Hi,

it did the same thing on Flexicontent, it has removed half the code : (
PHP opening tag echo + + + + $ this ->
So I think security by the code is cleaned!

Y is there an alternative?

On 15/07/2010 at 09:03 AM, Maxim said:

maxim

Hello,
This is normal because it is not possible to insert php code is security.
The only way you would then create your own plugin and therefore circumvented this problem.

On 17/07/2010 at 08:15, greg said:

greg

Ah! I was thinking too!
Well I'm not well versed to do that, I'll do it by hand pending. I'll try to see this plugin when I have more knowledge ;)

thank you for the answer

On 20/07/2010 at 07:45, chick said:

chick

Hello, before I launch into the adventure of creation, I want a plugin catalog, with a photo manager minigalerie style, with fields such as make, model, version, price, condition, description. It exists?

On 20/07/2010 at 09:11, Maxim said:

maxim

Hi Chick,
For all that is custom field (make, model, version, price, condition, description) there will be no worries. For part mini-gallery, FLEXIcontent manages some good photo but that is not dynamic to date (ie you can add a predefined number of pictures). However I know that a mini-gallery plugin is being prepared for its release date it's best to approach directly from the source: http://www.flexicontent.org
Good day

On 20/07/2010 at 10:26 AM, Chick said:

chick

mini gallery plugin exists in the latest version of FLEXIcontent. but how to ensure that all fields make a plugin that can be repeated. Or easier for me today because I am not at all computer (tantpis for mini gallery). How from the fields FLEXIcontent picture and modify it to add and edit fields?

On 20/07/2010 at 10:36 AM, Chick said:

chick

Oh damn you can not add "allow multiple values" field on the image FLEXIcontent ... How?

On 20/07/2010 at 11:16 AM, Maxim said:

maxim

Ah yes indeed, the mini gallery plugin output ;) I did not have the latest version to hand.
I do not understand your concern because you can then add as many photos as you like with this plugin ...
If you can explain in detail your needs

On 20/07/2010 at 12:01, chick said:

chick

I would like the image field, having a single field or I can change the alt attribute lines and title attribute in brand and model, add an online price, version, description. All that is necessary to create an article and that we can add in a simple manner as is done with text field to add a tab value. this creating a small catalog content in a FLEXIcontent. Is that possible?

On 20/07/2010 at 16:21, Maxim said:

maxim

Yes I do not see much difficulty in what you just described. FLEXIcontent can create as many custom fields as you want.
It is after you to lay out your fields correctly in your template to give the record that you want. But in fact I think if you want to interface a bit more advanced, it will certainly put your hands a little dirty in and change the basic templates.

On 20/07/2010 at 16:44, chick said:

chick

merci pour ta réponse, de toute façon je n'ai pas le choix je plonge en eaux troubles … Si je suis ma logique je dois faire un plugin en utilsant le plugin image + text x fois.

Le 20/07/2010 à 16:51 , Maxime a dit:

maxim

Oui en effet. Dans le cas où tu en aurais besoin, nous proposons des solutions commerciales de développement professionnel sur mesure.

Le 26/10/2010 à 19:02 , Steph a dit:

Steph

bonsoir tout l'monde :)
je suis gentiment redirigé vers ici par le forum Flexi, il parait qu'un mec touche assez bien sa bille avec la bête : Haha:
bref, trève d'éloges je redirige vers ma question : http://www.flexicontent.org/forum/index.php?f=9&t=2431&rb_v=viewtopic#p11152
@ +

Le 27/10/2010 à 10:19 , Maxime a dit:

maxim

Hello,
I just saw your concern, and indeed you can not do much without changing a few lines in the plugin or in the template. Tous à l'affichage montre la valeur du champs et non pas l'identifiant.
Tu peux donc modifier ton template pour afficher l'id avec : $this->fields['ton_champs']->value, mais le souci est qu'il ne prendre pas en compte ton plugin, il faudrait alors faire appel à l'exécution des plugins content de nouveau et je trouve ça un peu lourd.
Donc je te conseille de faire une copie du plugin de champs selectmultiple(.php et .xml), et d'en créer un nouveau que tu appelleras par exemple selectmultipleid.
Modifiie donc le nom de tes fichiers, modifier ton fichier xml en remplacant selectmultiple par selectmultipleid, fait la même chose dans ton fichier php. Puis modifie la méthode onDisplayFieldValue à partir de la ligne 208 où il ya marqué : if ($sql_mode){ et tu supprimes le tout jusqu'à la fin de la méthode et tu le remplace par :
$display = array();
for($n = 0, $c = count($values); $n < $c; $n++) {
$display[] = $pretext . JText::_($result->text) . $posttext;
}
if ($display) {
$field-> {$prop} = implode($separatorf, $display);
$field-> {$prop} = $opentag . $field-> {$prop} . $closetag;
Else {}
$field-> {$prop} = »;
}

Ca doit être bon maintenant.

Le 28/10/2010 à 06:52 , Steph a dit:

Steph

merci de partager ta patience et tes connaissances, à charge de revanche ! :drink:
après avoir été accusé d'utiliser des variables non déclarées ($result) ou d'avoir laissé ouvertes les fonctions suivantes (accolades), j'en suis là :

- le copié/collé ligne 208 ne marche pas…sans la requête, pas de $results
- je remplace donc le segment $display = array(); ligne 221 avec ton code
- j'ajoute le « saucissonnage » de $results en tranches de $result avec foreach($results as $result) {
et là ça marche très bien pour phpMyAdmin, avec les bonnes values associées au bon Field_ID et au bon Item_ID : D

…sauf que la page débute par une liste de « Warning >>> there is no article with id = xxxxxxx « (mes autres tranches de saucisson ;)

…sauf que mon plugin est aux abonnés absent pour afficher les values pourtant en base (malgré plugin publié, SQL OK, requête OK et qu'il marche sur un champ texte ???….bref, je poste ça et je retourne voir)

bref on est sur le chemin, mais y'a d'la boue
good day!

Le 06/11/2010 à 16:37 , emmanuel a dit:

emmanuel

Je suis entrain de faire un site web pour un ami qui a acheter un chouette templates yoo .mon soucis est le suivant ,j'utilise le template par défaut de flexi qui me suffit,pour ce qu'il veut mais dans la présentation de ces articles j'utilise les étiquetes ,mais ces étiquettes sur un fond noir apparaisse en gris ce qui n'est pas très lisible, je cherche dons simplement a modifier la taille de police de l'etiquette en h2 ou h3 ou h4 la couleur changerait en même temps que la couleur du template

thank you

Le 09/11/2010 à 15:25 , Maxime a dit:

maxim

Hello,
Ton problème c'est purement du CSS, il suffit de paramétrer correctement tes déclarations pour arriver au bon rendu. Il doit peut être y avoir des conflits entre le CSS de Yootheme et celui de Flexi.
La solution est tout simplement de reprendre tes fichiers CSS et d'effectuer les corrections nécessaire. Hélas je ne pourrais pas trop t'aider sur ce point.

Le 11/11/2010 à 11:08 , steph a dit:

steph

@Maxime : j'ai trouvé une solution de rechange propre et fonctionnelle que je posterai ce matin sur le forum d'origine. Encore merci de ton attention !

@emmanuel : je ne suis pas sûr de très bien comprendre si c'est la police en front ou en back end que tu souhaites modifier.
Dans le premier cas, il faudra créer ou modifier la balise de ton étiquette dans le CSS de ton template
Dans le deuxième c'est à l'adresse TonSite\components\com_flexicontent\templates\default\css\item.css
Astuce : quand je cherche le nom d'une classe ou d'un DIV, j'utilise la barre d'outil Web Develloper pour Firefox et je choisis d'entourer l'élément survolé en affichant son nom : tu as ainsi l'arborescence complète du body jusqu'à ton élément ;)

Le 21/11/2010 à 14:54 , pascal a dit:

pascal

Bonjour et merci pour ce tuto qui me rend service tous les jours ou presque…

J'aurais une petite question que je n'arrive pas à résoudre, je voudrais faire un champs personnalisé reprennant uniquement la catégorie principale et je ne trouve pas de solution… une idée ?
merci d'avanve

Le 22/11/2010 à 09:55 , Maxime a dit:

maxim

Hello,
Quelle est la difficulté que tu rencontres concrètement ? Où en est tu au niveau de ton développement ?

Le 22/11/2010 à 14:19 , pascal a dit:

pascal

J'ai une partie magazine, chaque article appartient à une catégorie fonctionnelle qui est ma catégorie principale. il appartient aussi à une catégorie dîte « Archive » qui me permet d'afficher tous les acticles sous forme de liste quelque soit la catégorie fonctionnelle. dans ce template lorsque je mets le champ catégorie, il apparait toutes les catégories (la catégorie principale et archive) je ne voudrais voir que la catégorie principale…
mon dev est terminé, juste ce petit truc qui me chiffone : (

Le 22/11/2010 à 17:32 , Maxime a dit:

maxim

Ah j'avais cru comprendre que tu avais développé un type de champs spécifique, ce n'est pas le cas apparament.
Je comprends ta demande, faire apparaître juste le nom de la catégorie… Donc 2 possibilités, soit créer un type de champs spécifique pour l'afficher (un peu lourd) ou soit une petit bidouille qui consiste à modifier ton template pour afficher juste le nom de la catégorie principale en tronquant le résultat retourner par :
$this->fields['categories']->display;

Le 23/11/2010 à 14:55 , pascal a dit:

pascal

ok merci du conseil, je vais regardé mais pour l'instant j'ai pas trouvé cette instruction.

Le 11/04/2011 à 13:54 , malouani a dit:

malouani

Hello,

je te remercie beaucoup pour ce tuto qui est formidable.
je voudrai savoir comment je fais pour afficher une image et la description en même temps, je m'explique: j'ai un menu qui contient des rubriques, je veux quand je clique sur une rubrique, il m'affiche une liste d'articles et chaque article est constitue de : titre, image , description. j'arrivais pas afficher ça, il m'affiche le titre,description et un lien Lire la suite et quand je clique sur lire la suite il m'affiche le titre, image, description.

Le 12/04/2011 à 10:34 , Maxime a dit:

maxim

Hello,
Tu as une possibilité de régler l'affichage des miniatures d'image dans les paramètres du template associé à la catégorie. Tu dois aller dans FLEXIcontent, gestion des catégories, modifier la catégorie en question.
Donc tu dois avoir le template « blog » qui est associé (ou un autre similaire), va dans les paramètres de ce template (paramètres blog). Là tu as les options qui te permettent de sélectionner et de formater l'image à afficher.

Le 20/04/2011 à 17:01 , malouani a dit:

malouani

Hello,

merci pour ta réponse, j'ai utilisé le template defaut et j'ai réussi à affiché les images,
j'ai une autre question:
j'ai créé une catégorie et dans cette catégorie j'ai créé des sous catégories qui contiennent des articles. quand je clique sur cette catégorie dans le menu, elle m'affiche en haut les sous catégories et en bas toutes les articles (sur la meme page), ce que je veux c'est quand je clique sur une sous catégorie, elle m'affiche TOUJOURS en haut les sous catégorie et en bas les articles de cette sous catégorie

Le 22/04/2011 à 09:11 , Maxime a dit:

maxim

Hello,
Ceci est plus complexe car l'affichage des sous-catégories dans FLEXIcontent est contextuel. Donc quand tu affiches les articles d'une sous catégorie, cette dernière ne peut pas en natif afficher les catégories du même niveau.
Il faut donc faire un peu de code et modifier le template pour arriver à tes fins.

Le 22/04/2011 à 11:07 , malouani a dit:

malouani

ok, merci beaucoup.

Le 18/05/2011 à 11:35 , malouani a dit:

malouani

Hello,

1. comment je fais pour afficher une liste déroulante (par exemple une liste des commune), j'ai utilisé le champs select mais il m'affiche la liste en backoffice et moi je veux l'afficher en front office pour que les utilisateurs puissent choisir la commune.
2. comment je fais quand l'utilisateur choisi une commune, je lui affiche le texte correspond à son choix (moi j'ai créé les différents textes à afficher mais j'arrive pas faire le lien entre le texte sélectionné par l'utilisateur et le texte à afficher ).

merci beaucoup pour les tutos.

Le 18/05/2011 à 12:51 , Maxime a dit:

maxim

Hello,
Il faut bien utiliser une liste select pour saisir vos informations, après votre besoin c'est de mettre en place des filtres.
Reportez vous à l'utilisation des filtres sous FLEXIcontent.

Le 21/06/2011 à 16:10 , Oliv a dit:

Oliv

Salut à tous
Un grand merci pour ce tuto qui m'a donné envie de développer un nouveau site.
Je débute, et je me casse la tête depuis trois jours!!
le plugin google est installé mais il n'apparaît pas dans le choix des plugin de contenu lors de la création d'un champ!!!
Aurais tu une idée!
: Idea:

Le 21/06/2011 à 16:25 , Maxime a dit:

maxim

Hello,
Le plugin est il bien publié dans joomla ?

Le 21/06/2011 à 18:29 , Oliv a dit:

Oliv

Oui, ma clé APi est configurée…
En revanche mon plugin code est mosmap
Joomla 1.5.23 instal serveur normal ( pas en module)
Hebergeur Ovh mutualisé
Si tu as une idée, je repasse en attendant toutes les configs
???

Le 22/06/2011 à 08:49 , Maxime a dit:

maxim

Hello,
Ah oui je n'avais pas vraiment compris ta demande initiale, je viens de saisir.
Mosmap est un plugin system, c'est à dire qu'il sera exécuté sur l'ensemble du contenu de ton site, donc pas besoin de le spécifier.
La liste des plugins qui apparaît dans flexicontent sont les plus plugins de content. Il n'est donc pas obligatoire pour toi de le préciser, tout devrait fonctionner.

Le 22/06/2011 à 18:09 , Oliv a dit:

Oliv

Hello!
Ok, je regarde cela demain, je pense finaliser mon projet d'ici deux semaines!
D'ici la je fonctionne en permanence, fenêtre ouverte sur ton site !!
Merci pour ton travail!
A +

Le 23/06/2011 à 10:22 , Oliv a dit:

Oliv

Hello!
J'ai tout réinstallé, impossible d'avoir le plugin mosmap aurai tu un lien direct sur la bonne version de ce dernier!
A +

Le 23/06/2011 à 14:25 , Oliv a dit:

Oliv

Ok!
J'ai réussi avec le plugin googleMaps (dans les plugins spécifiques des champs:
je n'ai pu installer le 2)
–> juste une différence de configuration sur les paramètres spécifiques du champs : enlever les espaces sinon vous pointez au large du Nigeria quelque soit votre adresse!!
encore merci pour ton travail!
;)

Le 23/06/2011 à 15:44 , Maxime a dit:

maxim

Thank you,
Le principal était d'y arriver.

Le 25/08/2011 à 08:23 , Tonyrocher a dit:

Tonyrocher

Hello,

J'aimerais savoir si vous avez fait une compil de vos tuto flexicontent en pdf .

Thank you in advance.

Tony

Le 25/08/2011 à 11:02 , Maxime a dit:

maxim

Hello,
Désolé, je nous n'avons pas mis en place ces tutos en version pdf.

Le 28/03/2012 à 17:25 , Thierry a dit:

Thierry

Hello,

Tout d'abord , merci pour votre tuto !! c'est génial !
j'ai une question, vous dites pour le parametre « publié »:
« Cependant il existe une astuce si vous ne souhaitez pas les faire apparaitre lors de la création d'un nouveau contenu, il suffit de ne pas affecter le champs au type de contenu en question et notre problème est résolu. "
Je n'arrive pas a ne pas lier le champs « DESCRIPTION » à tous les types…
Savez vous pourquoi ?
De même, je change l'étiquette « TITRE » du champs TITLE et l'étiquette ne change pas dans le front End. Y'a une option bien cachée quelque part ?

Thank you. et encore bravo

Thierry

Le 30/03/2012 à 10:10 , Maxime a dit:

maxim

Merci pour vos retours.
Afin de faire partager la communauté de l'expérience de chacun, nous ne répondons plus aux questions sur ce blog. Pouvez vous allez directement sur notre site d'extension et reporter votre demande sur le forum.
Le site est en anglais mais il existe une section française pour le forum.
http://extensions.netassopro.com

L'email ne sera pas affiché

Exemple de site internet

Votre commentaire:

| -)]o);): |:war:: Star:: S:pizza:: Pig::phone:: P:monk::listen::jail:: Idea:: Happy::halloween:: Haha::girl::ghost::drink:: D: Crazy::cold::cloudy:: @:): (: $8)(L)(A)(L)(6)