• Call Us
  • 360.322.4907 or 610.562.2900

Monday - Friday ( 10.00 - 17.00 EST / 07.00 - 14.00 PST )

Adding Your Own Layout

Sometimes, you want to customize the display of a component to make it more suitable to your needs. Most of the time, if you modify code, you lose your modifications the next time you update. 

NS Recipes has been developed according to Joomla Framework requirements.

Recipe Blog Layouts

Since version 5.0.0, NS Recipes uses Joomla layouts for blog pages and recipe page displays.

These layouts are defined in /components/com_nsrecipes/layouts folder. NS Recipes automatically detects available layouts in "Component Options," as shown below.

In other words, adding a new display layout consists in adding a file under /components/com_nsrecipes/layouts/recipes or /components/com_nsrecipes/layouts/recipe folder.

Create your own layout

Let's assume you copied a layout to mylayout.php. Half of the work is already done. You just have to edit your mylayout.php file and modify the code as you want.

NS Recipes uses PHP Objects and we assume you have at least basic PHP programming skills.

A recipe object can be represented like this:

 

stdClass Object
(
    [id] => 487
    [access] => 1
    [title] => Zesty Sundried Tomato Broccoli Capellini
    [alias] => zesty-sundried-tomato-broccoli-capellini
    [description] => 	How to make Zesty Sundried Tomato Broccoli Capellini
    [created_by] => 61
    [preparation] => PREPARATION TEXT
    [serving_type_id] => 1
    [nb_persons] => 4
    [difficulty] => 2
    [cost] => 2
    [sugar] => 0
    [carbs] => 0
    [fat] => 0
    [saturated_fat] => 0
    [cholesterol] => 0
    [proteins] => 0
    [fibers] => 0
    [salt] => 0
    [kcal] => 337
    [kjoule] => 0
    [diet] => BOOLEAN
    [veggie] => BOOLEAN
    [gluten_free] => BOOLEAN
    [lactose_free] => BOOLEAN
    [creation_date] => 2015-05-20 11:46:44
    [publish_up] => 0000-00-00 00:00:00
    [publish_down] => 0000-00-00 00:00:00
    [preparation_time] => 15
    [cook_time] => 25
    [wait_time] => 10
    [picture] => images/com_yoorecipe/61/broccoli.jpg
    [video] => 
    [published] => 1
    [cuisine] => LATIN
    [validated] => 1
    [featured] => 1
    [nb_views] => 3
    [note] => 
    [language] => en-GB
    [language_title] => English (UK)
    [servings_type] => Person(s)
    [metakey] => 
    [metadata] => 
    [use_slider] => 1
    [slug] => 487:zesty-sundried-tomato-broccoli-capellini
    [catslug] => 79:plats
    [favourite] => 0
    [author_name] => Super Utilisateur
    [author_email] => email address
    [access_level] => Accès Public
    [ingredients] => Array of stdClass objects
    [categories] => Array of stdClass objects
    [seasons] => Array()
    [ratings] => Array()
    [tags] => JHelperTags Object
    [similar_recipes] => Array of recipes objects
)

Echoing a recipe title can be done this way:

echo $recipe->title

Our advice is to look at already existing layouts, so that you create your own layout quickly.

  • Thursday, 20 July 2017

Support is currently

Support Forum

Announcements
  1. 0 subcategories
General / Billing Questions
  1. 0 subcategories
NS FontAwesome Pro
  1. 2 subcategories
Stripe for RSForm Pro
  1. 2 subcategories
Stripe for RSMembership
  1. 2 subcategories
Stripe for RSEvents
  1. 2 subcategories
NS Members Only
  1. 2 subcategories
NS Mail Template
  1. 2 subcategories
Bitcoin for RSForm Pro
  1. 2 subcategories
NS Share Intent for Zoo
  1. 2 subcategories
NS Name Split
  1. 2 subcategories
NS Formula
  1. 2 subcategories
NS MeetUp
  1. 2 subcategories
NS Nerds
  1. 2 subcategories
NS DownloadShop
  1. 2 subcategories
NS Client Credits
  1. 1 subcategory
NS Recipe
  1. 2 subcategories
CiviCRM for RSForm
  1. 2 subcategories
Marysville, WA 98270 United States
(360) 322-4907
Hamburg, PA 19526 United States
(610) 562-2900