GetSimple Support Forum
URL href - Printable Version

+- GetSimple Support Forum (http://get-simple.info/forums)
+-- Forum: GetSimple (http://get-simple.info/forums/forumdisplay.php?fid=3)
+--- Forum: General Questions and Problems (http://get-simple.info/forums/forumdisplay.php?fid=16)
+--- Thread: URL href (/showthread.php?tid=5567)



URL href - ZackWhite - 2014-01-29

Hi,

I'm relatively new to GS but I'm learning. I stumbled upon my first problem with links. I have a menu consisting of 4 links and I need to link them to their respective pages.

I know you can use:
PHP Code:
<?php get_navigation(return_page_slug()); ?>

but I'm currently using a different method because I call each link individually via this code (the variable $menu_1 contains the first item of my menu, I have 3 more):
PHP Code:
<li><a href=""><?php echo $menu_1['slug'];    ?></a></li> 

Now, what do I have to place as the href?

Thx in advance


RE: URL href - yojoe - 2014-01-29

use one of php $_SERVER variables, or just GS: get_site_url(); functions, along with your menu slug var


RE: URL href - Carlos - 2014-01-29

If those are top-level pages (no parent):
Code:
<?php echo find_url($menu_1['slug'], ''); ?>



RE: URL href - ZackWhite - 2014-01-30

(2014-01-29, 16:48:30)Carlos Wrote: If those are top-level pages (no parent):
Code:
<?php echo find_url($menu_1['slug'], ''); ?>

Works like a charm! Thanks!


RE: URL href - shawn_a - 2014-01-30

Carlos you think we might want to add a theme function alias for that, like get_page_url ?
Or get_nav_url or sumtin.


RE: URL href - Carlos - 2014-01-30

Would be nice. get_page_url exists, so...
Could be get_page_link, though right now it should be getPageLink, unless:
https://github.com/GetSimpleCMS/GetSimpleCMS/issues/302#issuecomment-32723060

Would not be exaclty an alias BTW, you have to get the parent (or path, when GS supports multilevel urls) to do it properly.