DEV Community

Cover image for NameValue content
elanatframework
elanatframework

Posted on

NameValue content

One of the great features that Elanat framework core gives you is to create content based on name and value.
You can name the values and then display different content types in different categories.

You can open the site_global.xml template file in the template directory for editing and create a new content type template in the following path:
template_root/content/content_type_name
And for content that is displayed alone:
template_root/content/alone_content_type_name

Note:

content_type_name and alone_content_type_name is an example and you can use your own values instead.
You can then create named values as follows to call the values:
$_nv example_name;

To understand more, you can see the following example:
This simple example displays the values of an image content type.

image_path=/upload/special/example.png

image_path is the name
/upload/special/example.png is the value

Variable $_nv image_path; In the template file, it calls the /upload/special/example.png value.

If value contained several lines, instead of the next lines from the variable $_asp new_line; is used.

Example for video content type:

Video value in content_text column in el_content table in Elanat database:

video_path=/upload/video/video_name.mp4
thumbnail_path=/upload/video_thumb/video_name.mp4
title=Video title
description=Video description
duration=150
resolution=1080x1920
size=5840000
format=mp4
category=Video category
Enter fullscreen mode Exit fullscreen mode

Video content type template:

<b>$_nv title;</b>
<br>
<p>$_nv description;</p>
 <video width="640" height="480" controls>
  <source src="$_nv video_path;" type="video/$_nv format;">
  Your browser does not support the video tag.
</video> 
Enter fullscreen mode Exit fullscreen mode

Content that the user views:

video content type

Top comments (0)