Skip to content
View in the app

A better way to browse. Learn more.

MagicDuel Community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Templates

Featured Replies

  • Root Admin

Copied From Murs initial Post (no code changed)

Templates

Function:

mds_template(template,data,return,columns,attributes);

Parameters:
template = template to use for each data displayed. Variables in this template should be noted as [[somename]] where 'somename' can be anything
data = can be an array with keys named like the strings enclosed in [[...]] in the template or a multidimensional array for more records. Such an array has each of its items as an array with values
return = if its true, function will return the string so it can be used in the script, if its false, it will display the result directly.
columns = for multidimensional arrays, this parameter tells on how many columns they should be displayed. If its false or 1 the records will be displayed one per row. It has no use if the data array does not contain multiple records.
attributes = when displaying multiple records, they get organized in a table. The attributes parameter can contain a string to be placed inside the <td ...> tag of each cell. This could be a style an attribute but also javascript or anything that is html valid.

You can use bits of content as templates with variables.
@content[1] is the content after the first content separator
lets say for this example template code contains:

[php]<b>[[name]]</b><br>[[rowinfo]]<br>Details: [[more]][/php]


Script to use this template:

[php]//make sure @tpl its empty
@tpl = array(); [php]<b>[[name]]</b><br>[[rowinfo]]<br>Details: [[more]]

//do something 20 times
for(@va=0;@va<20;@va++){
@tpl[@va]['name'] = "Record {@vk}";
@tpl[@va]['rowinfo'] = "Row {@vk} has value".@vv;
@tpl[@va]['more'] = "more values ...";
}

//call template function
mds_template(@content[1],@tpl,true,3,'style="border:1px solid"');[/php]


This will display the content in @tpl, on 3 columns, each time parsing the template in @content[1]. The style indicated in the last parameter will be used on each of the 20 table cells created.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

Forum Statistics

  • Total Topics 17.5k
  • Total Posts 182.2k

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.