Posts: 1,920
Threads: 87
Joined: Apr 2010
is it possible to come up with some function, that to link in the menu are relative, not absolute
Posts: 6,266
Threads: 181
Joined: Sep 2011
Should be easy to do.
The get_nav... function uses find_url() get the path and it takes a param for relative.
So we can pass one through get_nav or use some global option.
PHP Code: * @param string $slug * @param string $parent * @param string $type Default is 'full', alternative is 'relative' * @return string */ function find_url($slug, $parent, $type='full') {
Posts: 1,920
Threads: 87
Joined: Apr 2010
2013-10-07, 23:56:53
(This post was last modified: 2013-10-07, 23:59:14 by Oleg06.)
I've changed so in basic.php much but were absolute links
Code: function find_url($slug, $parent, $type='relative') {
global $PRETTYURLS;
global $SITEURL;
global $PERMALINK;
if ($type == 'relative') {
$full = $SITEURL;
} elseif($type == 'relative') {
(2013-10-07, 22:53:10)shawn_a Wrote: Should be easy to do.
The get_nav... function uses find_url() get the path and it takes a param for relative.
So we can pass one through get_nav or use some global option.
PHP Code: * @param string $slug * @param string $parent * @param string $type Default is 'full', alternative is 'relative' * @return string */ function find_url($slug, $parent, $type='full') {
Posts: 6,266
Threads: 181
Joined: Sep 2011
Change theme_functions
get_naviagtion
This add the param type ( default relative )
PHP Code: /** * Get Main Navigation * * This will return unordered list of main navigation * This function uses the menu opitions listed within the 'Edit Page' control panel screen * * @since 1.0 * @uses GSDATAOTHERPATH * @uses getXML * @uses subval_sort * @uses find_url * @uses strip_quotes * @uses exec_filter * * @param string $currentpage This is the ID of the current page the visitor is on * @param string $classPrefix Prefix that gets added to the parent and slug classnames * @param string $type "relative" or "full" links * @return string */ function get_navigation($currentpage,$classPrefix = "", $type='relative') {
$menu = '';
global $pagesArray; $pagesSorted = subval_sort($pagesArray,'menuOrder'); if (count($pagesSorted) != 0) { foreach ($pagesSorted as $page) { $sel = ''; $classes = ''; $url_nav = $page['url']; if ($page['menuStatus'] == 'Y') { $parentClass = !empty($page['parent']) ? $classPrefix.$page['parent'] . " " : ""; $classes = trim( $parentClass.$classPrefix.$url_nav); if ("$currentpage" == "$url_nav") $classes .= " current active"; if ($page['menu'] == '') { $page['menu'] = $page['title']; } if ($page['title'] == '') { $page['title'] = $page['menu']; } $menu .= '<li class="'. $classes .'"><a href="'. find_url($page['url'],$page['parent'],$type) . '" title="'. encode_quotes(cl($page['title'])) .'">'.strip_decode($page['menu']).'</a></li>'."\n"; } } } echo exec_filter('menuitems',$menu); }
Posts: 1,920
Threads: 87
Joined: Apr 2010
Thank you very much remains to get rid of this
(2013-10-07, 23:59:37)shawn_a Wrote: Change theme_functions
get_naviagtion
This add the param type ( default relative )
PHP Code: /** * Get Main Navigation * * This will return unordered list of main navigation * This function uses the menu opitions listed within the 'Edit Page' control panel screen * * @since 1.0 * @uses GSDATAOTHERPATH * @uses getXML * @uses subval_sort * @uses find_url * @uses strip_quotes * @uses exec_filter * * @param string $currentpage This is the ID of the current page the visitor is on * @param string $classPrefix Prefix that gets added to the parent and slug classnames * @param string $type "relative" or "full" links * @return string */ function get_navigation($currentpage,$classPrefix = "", $type='relative') {
$menu = '';
global $pagesArray; $pagesSorted = subval_sort($pagesArray,'menuOrder'); if (count($pagesSorted) != 0) { foreach ($pagesSorted as $page) { $sel = ''; $classes = ''; $url_nav = $page['url']; if ($page['menuStatus'] == 'Y') { $parentClass = !empty($page['parent']) ? $classPrefix.$page['parent'] . " " : ""; $classes = trim( $parentClass.$classPrefix.$url_nav); if ("$currentpage" == "$url_nav") $classes .= " current active"; if ($page['menu'] == '') { $page['menu'] = $page['title']; } if ($page['title'] == '') { $page['title'] = $page['menu']; } $menu .= '<li class="'. $classes .'"><a href="'. find_url($page['url'],$page['parent'],$type) . '" title="'. encode_quotes(cl($page['title'])) .'">'.strip_decode($page['menu']).'</a></li>'."\n"; } } } echo exec_filter('menuitems',$menu); }
Posts: 6,266
Threads: 181
Joined: Sep 2011
Where do you get that?
I do not get anything like that.
Posts: 1,920
Threads: 87
Joined: Apr 2010
I changed the file theme_functions.php[/b]
Code: <ul class="nav">
<li><a href="#index">Главная</a></li><li class="vvvvvvvvvvv"><a href="\/#vvvvvvvvvvv" title="ввввввввввв">ууууууууууууу</a></li>
<li class="shshshshshshshshshshsh"><a href="\/#shshshshshshshshshshsh" title="шшшшшшшшшшш">шшшшшшшшшшш</a></li>
<li class="dddddddddddd"><a href="\/#dddddddddddd" title="дддддддддддд">дддддддддддд</a></li>
<li class="eeeeeeeeeeeee"><a href="\/#eeeeeeeeeeeee" title="еееееееееееее">еееееееееееее</a></li>
<li class="yyyyyyyyyy"><a href="\/#yyyyyyyyyy" title="ыыыыыыыыыы">ыыыыыыыыыы</a></li>
</ul>
[b] (2013-10-08, 00:12:59)shawn_a Wrote: Where do you get that?
I do not get anything like that.
Posts: 6,266
Threads: 181
Joined: Sep 2011
you were not supposed to change find_url at all.
Posts: 1,920
Threads: 87
Joined: Apr 2010
I did not change basic.php
Posts: 1,920
Threads: 87
Joined: Apr 2010
may slash appears only on the local server
Posts: 6,266
Threads: 181
Joined: Sep 2011
Posts: 1,920
Threads: 87
Joined: Apr 2010
2013-10-08, 07:18:15
(This post was last modified: 2013-10-08, 07:23:25 by Oleg06.)
yes it is Denver on Windows7, I checked for hosting your suggestion works, but one slash is still, so I had to change the code in the file basic.php
Code: } elseif($type == 'relative') {
$s = pathinfo(htmlentities($_SERVER['PHP_SELF'], ENT_QUOTES));
$full = str_replace('', '', $full);
when the debug mode displays a warning
Code: Notice: Undefined variable: full in B:\home\0parallax.ru\www\admin\inc\basic.php on line 429
[Денвер: показать возможную причину ошибки]
Notice: Undefined variable: full in B:\home\0parallax.ru\www\admin\inc\basic.php on line 429
Notice: Undefined variable: full in B:\home\0parallax.ru\www\admin\inc\basic.php on line 429
Notice: Undefined variable: full in B:\home\0parallax.ru\www\admin\inc\basic.php on line 429
Notice: Undefined variable: full in B:\home\0parallax.ru\www\admin\inc\basic.php on line 429
, but it works
I want to use this script
http://getbootstrap.com/javascript/#scrollspy
links should look like this <a href="#about" title="about">About</a>
Posts: 6,266
Threads: 181
Joined: Sep 2011
That is not a relative link, that is an anchor, you should be looking at a making a single page site. There is more information around the forums.
Posts: 1,920
Threads: 87
Joined: Apr 2010
Posts: 1,920
Threads: 87
Joined: Apr 2010
problem was solved very simply with the use of plugin i18n
Posts: 321
Threads: 15
Joined: Feb 2012
I use i18n plugin for dropmenus and it helps a lot
But I have to admit that this Bootstrap javascript rocks badly!
Oleg, would you like to share here some codeline to inspire someone (just me)? :-D
My website made with GetSimple CMS is
Arte & Società
www.artesocieta.eu
An indipendent website about Italian Contemporary Visual Arts
Posts: 1,920
Threads: 87
Joined: Apr 2010
2013-11-03, 17:20:27
(This post was last modified: 2013-11-03, 17:21:33 by Oleg06.)
I used the following code to the menu component
Code: <li class="<?php echo $item->classes; ?>">
<a href="#<?php echo htmlspecialchars($item->slug); ?>">
<?php echo htmlspecialchars($item->text); ?>
</a>
</li>
I'm trying to make a Landing Page
Posts: 321
Threads: 15
Joined: Feb 2012
Thanks for sharing, mate.
I am gonna try something like this...
Landing Page? Are you in the web-marketing stuff?
My website made with GetSimple CMS is
Arte & Società
www.artesocieta.eu
An indipendent website about Italian Contemporary Visual Arts
Posts: 1,920
Threads: 87
Joined: Apr 2010
rather, try to work
|