• Welcome to WooUSEFUL by PHPVIBE . Please log in.
avatar_Marius

Check or target routes/views

Started by Marius,

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

MariusTopic 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)
Example:

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.

If this helped, consider buying me a coffee.
20 years coding, tweaking, building in PHP. Still creating!
  •  

Similar topics (7)