Git Product home page Git Product logo

sculpintagcloudbundle's Introduction

SculpinTagCloudBundle

SensioLabsInsight

This bundle generates a tag cloud in sculpin.

You can see a working demo on the right column of my personal french blog.

Installation

Using composer, add the dependancy to your composer.json :

require: {
    "jbouzekri/sculpin-tag-cloud-bundle": "1.*"
}

And run the composer update command

Enable the bundle. If you have already have an app/SculpinKernel.php, add this bundle to it otherwise create the file with the following content :

<?php

class SculpinKernel extends \Sculpin\Bundle\SculpinBundle\HttpKernel\AbstractKernel
{
    protected function getAdditionalSculpinBundles()
    {
        return array(
            'Jb\Bundle\TagCloudBundle\JbTagCloudBundle'
        );
    }
}

Then you need to add the tag cloud template and its stylesheets to your project

  • Copy the Resources/views/tag_cloud.html file in the _includes folder of your source
  • Copy the Resources/public/css/tag_cloud.css file in the css folder of your source (or you can directly add its content in your project stylesheets).

Usage

In a template, you can now call the following twig function :

{{ tag_cloud() }}

It will generate the html tag cloud.

You can specify a custom template :

{{ tag_cloud('my_template.html') }}

Configuration

jb_tag_cloud:
    tag_permalink: /tags/:taxon/index.html
    tag_entity: Jb\Bundle\TagCloudBundle\Model\Tag
    tag_cloud_entity: Jb\Bundle\TagCloudBundle\Model\TagCloud
    max_number: 0
    strategies:
        - jb_sculpin.tag_cloud.strategy.shuffle
        - jb_sculpin.tag_cloud.strategy.percent_size
  • jb_tag_cloud.tag_permalink : the pattern used for the url in the tag_cloud twig helper
  • jb_tag_cloud.tag_entity : the tag entity
  • jb_tag_cloud.tag_cloud_entity : the tag cloud entity
  • jb_tag_cloud.strategies : A list of services to manipulate the tag cloud. By default, shuffle randomize the order of the tags and percent_size calculate the tag weight based on its number of apparition.
  • jb_tag_cloud.max_number : used when enabling the strategy jb_sculpin.tag_cloud.strategy.max_number which will limit the number of tags to display in the cloud (if 0, all tags are displayed). This is global and will be applied to all tag clouds.

License

MIT

This bundle was inspired by the tag-cloud library from lotsofcode

sculpintagcloudbundle's People

Contributors

jbouzekri avatar

Watchers

Tim Broder avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.