Created
April 23, 2014 13:37
-
-
Save ivandoric/11215483 to your computer and use it in GitHub Desktop.
drupal: Example of EntityFieldQuery to make Flex slider in Drupal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$query = new EntityFieldQuery(); | |
$query->entityCondition('entity_type', 'node') | |
->propertyCondition('status', 1) | |
->propertyCondition('type', array('slider_gornji')) | |
->propertyOrderBy('created', 'DESC') | |
->range(0, 5); | |
$result = $query->execute(); | |
$nodes = node_load_multiple(array_keys($result['node'])); | |
#print_r($nodes); | |
?> | |
<ul class="slides"> | |
<?php foreach ($nodes as $slide) { ?> | |
<li style="background:url(http://did.gaussdev.com/sites/default/files/styles/main_slider_image/public/<?php print render($slide->field_slika['und'][0]['filename']); ?>) no-repeat top center"> | |
<div class="slide-text"> | |
<h2><?php print render($slide->title); ?></h2> | |
<p><?php print substr(render($slide->body['und'][0]['value']), 0, 200); ?></p> | |
<a class="more-link" href="<?php print render($slide->field_link['und'][0]['value']); ?>">Saznajte više...</a> </div><!--/slide-text--> | |
</li> | |
<?php /*print render($lokacija->field_naziv_tvrtke[LANGUAGE_NONE]['0']['value']).'<br />';*/ ?> | |
<?php } ?> | |
</ul> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment