Giter Club home page Giter Club logo

ruianseobundle's Introduction

RuianSeoBundle

Build Status

Installation

Step 1) Get the bundle

First, grab the RuianSeoBundle :

Add the following lines to your deps file and then run php bin/vendors install:

[RuianSeoBundle]
    git=git://github.com/ruian/RuianSeoBundle.git
    target=bundles/Ruian/SeoBundle

Step 2) Register the namespaces

Add the following two namespace entries to the registerNamespaces call in your autoloader:

<?php
// app/autoload.php
$loader->registerNamespaces(array(
    // ...
    'Ruian' => __DIR__.'/../vendor/bundles',
    // ...
));

Step 3) Register the bundle

To start using the bundle, register it in your Kernel:

<?php
// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new Ruian\SeoBundle\RuianSeoBundle(),
    );
    // ...
)

Use it

You can set your title and metas with the DIC (all entries are optional)

#/app/config/config.yml
ruian_seo:
    title_prefix: '[FR] '
    title: "My website is awesome"
    title_suffix: ' - jgalenski.com'
    metas:
        keywords: "Cool, stuff"
        description: "a cool description"
        ...: ...
    metas_http_equiv:
        charset: "utf8"
        ...: ...

Or with your controller

//... DefaultController.php
public function indexAction()
{
    // ...
    $this->get('ruian.seo.page')->setTitle("My website title");
    $this->get('ruian.seo.page')->setMeta('keywords', "Cool, stuff");
    $this->get('ruian.seo.page')->setMeta('description', "a cool description");
    $this->get('ruian.seo.page')->setMetaHttpEquiv('charset', 'utf8');
    // ...
)

And now see the result in your layout/view

PHP

<html>
<head>
    <?php echo $view['ruian.seo.page']->renderTitle() ?>
    <?php echo $view['ruian.seo.page']->renderMetas() ?>
</head>
<body>
    <!-- ... -->
</body>
</html>

TWIG

<html>
<head>
    {{ ruian_seo_title() }}
    {{ ruian_seo_metas() }}
</head>
<body>
    <!-- ... -->
</body>
</html>

TODO

...

ruianseobundle's People

Contributors

ruian avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

ptitcub

ruianseobundle's Issues

There is no extension able to load the configuration for "ruian_seo"

During updgrade to Symfony 2.1, i got this error :

You have requested a non-existent service "ruian.seo.page".

my config.yml is

ruian_seo: 
    engine: php 
    title_prefix: ''
    title_prefix: ''

and AppKernel.php :

new Ruian\SeoBundle\RuianSeoBundle(),

./app/console container:debug doesn't show any ruian_seo service...

I think the problem come form autoload.php.dist (registerNamespaces is hard coded...) :

$loader = new UniversalClassLoader();
$loader->registerNamespaces(array(
    'Symfony'                => array($vendorDir.'/symfony/src', $vendorDir.'/bundles'),
));
$loader->register();

Any help?

thx

Composer support?

Hi Mister,

do you plan composer support about your bundle?

I'm upgrade my project and I need it ;)

Thanks very much

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.