getlink() and adminlink() ⇒ Frequently Asked Questions ⇒ CPG Dragonfly™ CMS

So, what is getlink() and how can I use it?

getlink() is a function we created for ease of writing URLs. Using getlink() is a much better alternative to using $mainindex when writing URLs.

To convert a URL using modules.php, follow this example:

echo '<a href="modules.php?name=Search">Search</a>';

echo '<a href="'.getlink('Search').'">Search</a>';

Read more on function getlink() here

What about adminlink()?

The same concept applies for adminlink().

To convert a URL using admin.php, follow this example:

echo '<a href="admin.php?op=logout">Logout</a>';

echo '<a href="'.adminlink('logout').'">Logout</a>';

Read more on function adminlink() here

What are $mainindex and $adminindex?

$mainindex is a new variable that we created for use in config.php. A default value of index.php is assigned to this variable, and acts as the main index page. Perhaps you wish to use cms.php instead of index.php for your homepage and calls to modules. Simply change the value of $mainindex in config.php and rename the file index.php to the name of your choice.

Read more on $mainindex here

$adminindex serves the same purpose, just for the administration menu.

Read more on $adminindex here

What happened to modules.php?

While developing CPG-Nuke, we moved all functions from modules.php to index.php. Thus, the call for a module changed from modules.php?name= to index.php?name=.

However, we left modules.php in place for compatibility with third party addons and themes.
User Info

Welcome Anonymous


Support for DragonflyCMS in a other languages: