Jump to content

Search the Community

Showing results for tags 'html helper'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to ProcessWire
    • News & Announcements
    • Showcase
    • Wishlist & Roadmap
  • Community Support
    • Getting Started
    • Tutorials
    • FAQs
    • General Support
    • API & Templates
    • Modules/Plugins
    • Themes and Profiles
    • Multi-Language Support
    • Security
    • Jobs
  • Off Topic
    • Pub
    • Dev Talk

Product Groups

  • Form Builder
  • ProFields
  • ProCache
  • ProMailer
  • Login Register Pro
  • ProDrafts
  • ListerPro
  • ProDevTools
  • Likes
  • Custom Development

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests

Found 1 result

  1. I, bored to write HTML elements inside my PHP code and i wrote a function for use less HTML elements. I think this function also could be helpful for you and maybe we can extend this function for use with all field types. For the moment the function only supporting fields like text, textarea or like these fields. What is this function making ? - Simply this function helping you to write less HTML elements in your PHP code. For the moment its only a function maybe i can make it a module. If you interest, here is gist link : https://gist.github.com/trk/b365f47793927006b1fb Module Usage (Available configs): <?php // Available configs $AvbMarkupOutputConfigs = array( 'tag' => 'div', // Usage for self closed tag : 'hr:/', 'i:/' 'attributes' => array( 'class' => 'element-class', // output : class='element-class' 'id' => 'element-id' // output : id='element-id' // Attributes ), 'data-attributes' => array( 'lat' => 'a-data-attribute' // output: data-lat='a-data-attribute' // Data Attributes : enter like normal attributes output will be data-your-attribute ), 'prepend' => array( // You can use here like main ), 'prepends' => array( array( // You can use here like main ), array( // You can use here like main ) // ..... ), 'field' => 'title', // a field name from your page 'value' => 'a custom value', 'loop' => array( 'tag' => 'div', // Usage for self closed tag : 'hr:/', 'i:/' 'attributes' => array( 'class' => 'element-class', // output : class='element-class' 'id' => 'element-id' // output : id='element-id' // Attributes ), 'data-attributes' => array( 'lat' => 'a-data-attribute' // output: data-lat='a-data-attribute' // Data Attributes : enter like normal attributes output will be data-your-attribute ), 'prepend' => array( // You can use here like main ), 'prepends' => array( array( // You can use here like main ), array( // You can use here like main ) // ..... ), 'fields' => array( 'title', 'body' // Field names from your page ), 'values' => array( 'Custom Value 1', 'Custom Value 2', 'Custom Value 3' // You can use custom values for here ), 'append' => array( // You can use here like main ), 'appends' => array( array( // You can use here like main ), array( // You can use here like main ) // ..... ) ), 'child' => array( // You can use here like main ), 'children' => array( array( // You can use here like main ), array( // You can use here like main ) // ..... ), 'append' => array( // You can use here like main ), 'appends' => array( array( // You can use here like main ), array( // You can use here like main ) // ..... ), ); AvbMarkupOutput($AvbMarkupOutputConfigs, $page) ?> Here are some examples about usage, i will make a before this function and after this function : Before : <?php $additionals = "foo bar some custom data"; echo "\n<article class='uk-article'> \n\t<h1 class='uk-article-title'>{$page->title}</h1> \n\t<hr class='uk-article-divider' /> \n\t{$page->body} \n\t{$additionals} \n</article>"; ?> After : <?php $additionals = "foo bar some custom data"; echo AvbMarkupOutput(array( 'tag' => 'article', 'attributes' => array( 'class' => 'uk-article' ), 'children' => array( array( 'tag' => 'h1', 'attributes' => array( 'class' => 'uk-article-title' ), 'field' => 'title', 'append' => array( 'tag' => 'hr:/', 'attributes' => array( 'class' => 'uk-article-divider' ) ) ), array( 'field' => 'body' ), array( 'value' => $additionals ) ) )); ?> Dive deep : <?php echo AvbMarkupOutput(array( 'tag' => 'div', 'attributes' => array( 'class' => 'uk-container uk-container-center' ), 'child' => array( 'tag' => 'section', 'attributes' => array( 'class' => 'page' ), 'child' => array( 'tag' => 'article', 'attributes' => array( 'class' => 'uk-article' ), 'children' => array( array( 'tag' => 'h1', 'attributes' => array( 'class' => 'uk-article-title' ), 'field' => 'title', 'append' => array( 'tag' => 'hr:/', 'attributes' => array( 'class' => 'uk-article-divider' ) ) ), array( 'field' => 'body' ) ) ) ) )); ?> <!-- Output --> <div class='uk-container uk-container-center'> <section class='page'> <article class='uk-article'> <h1 class='uk-article-title'><?=$page->title;?></h1> <hr class='uk-article-divider'/> <?=$page->body?> </article> </section> </div> <?php // Create a table same like this :: http://getuikit.com/docs/table.html#usage echo AvbMarkupOutput(array( 'tag' => 'table', 'attributes' => array( 'class' => 'uk-table' ), 'children' => array( array( 'tag' => 'caption', 'value' => 'Table caption' ), array( 'tag' => 'thead', 'child' => array( 'tag' => 'tr', 'child' => array( 'loop' => array( 'tag' => 'th', 'values' => array( 'Table Heading', 'Table Heading', 'Table Heading', 'Table Heading' ) ) ) ) ), array( 'tag' => 'tfoot', 'child' => array( 'tag' => 'tr', 'child' => array( 'loop' => array( 'tag' => 'td', 'values' => array( 'Table Footer', 'Table Footer', 'Table Footer', 'Table Footer' ) ) ) ) ), array( 'tag' => 'tbody', 'child' => array( 'children' => array( array( 'tag' => 'tr', 'child' => array( 'loop' => array( 'tag' => 'td', 'values' => array( 'Table Data', 'Table Data', 'Table Data', 'Table Data' ) ) ) ), array( 'tag' => 'tr', 'child' => array( 'loop' => array( 'tag' => 'td', 'values' => array( 'Table Data', 'Table Data', 'Table Data', 'Table Data' ) ) ) ), array( 'tag' => 'tr', 'child' => array( 'loop' => array( 'tag' => 'td', 'values' => array( 'Table Data', 'Table Data', 'Table Data', 'Table Data' ) ) ) ), array( 'tag' => 'tr', 'child' => array( 'loop' => array( 'tag' => 'td', 'values' => array( 'Table Data', 'Table Data', 'Table Data', 'Table Data' ) ) ) ) ) ) ) ) )); ?> <!-- Output --> <table class='uk-table'> <caption>Table caption</caption> <thead> <tr> <th>Table Heading</th> <th>Table Heading</th> <th>Table Heading</th> <th>Table Heading</th> </tr> </thead> <tfoot> <tr> <td>Table Footer</td> <td>Table Footer</td> <td>Table Footer</td> <td>Table Footer</td> </tr> </tfoot> <tbody> <tr> <td>Table Data</td> <td>Table Data</td> <td>Table Data</td> <td>Table Data</td> </tr> <tr> <td>Table Data</td> <td>Table Data</td> <td>Table Data</td> <td>Table Data</td> </tr> <tr> <td>Table Data</td> <td>Table Data</td> <td>Table Data</td> <td>Table Data</td> </tr> <tr> <td>Table Data</td> <td>Table Data</td> <td>Table Data</td> <td>Table Data</td> </tr> </tbody> </table> You can make nested calls !
×
×
  • Create New...