avatar_Marius P.

Check or target routes/views

Started by Marius P.,

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Marius P.Topic starter

PHPVibe comes with a few simple but efficient conditional functions for components restrictions (all located in lib/functions.php):

is_home() – Returns true if the current page is the homepage
is_video() – Returns true for single video & music pages
is_picture() – Returns true for single image
is_channel() – Returns true for single channel

For all the rest you could use the function is_com($com)

if(is_com('login')) {
/* You are on the login page */}
To see the components you could check the router declarations in index.php

$router->map('/api/:section', 'api', array('methods' => 'GET', 'filters' => array('section' => '(.*)')));

The structure is RewritenUrl format, Component, arrays of methods.

You could also just

echo com();
to print the current component.

Happy with my help? Buy me a coffee.
Please, always use the search before opening a new topic! We're all here on our (limited) free time! Make sure you help yourself too!