Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
link in the menu are relative
#1
is it possible to come up with some function, that to link in the menu are relative, not absolute
Reply
#2
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') { 
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#3
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') { 
Reply
#4
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);

NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#5
Thank you very much remains to get rid of this
Code:
<a href="\/
(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);

Reply
#6
Where do you get that?

I do not get anything like that.
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#7
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.
Reply
#8
you were not supposed to change find_url at all.
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#9
I did not change basic.php
Reply
#10
may slash appears only on the local server
Reply
#11
is it windows ?
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#12
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>
Reply
#13
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.
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#14
I use a theme http://get-simple.info/extend/theme/onep...ation/629/, but as absolute links, the script does not work http://getbootstrap.com/javascript/#scrollspy Smile
Reply
#15
problem was solved very simply with the use of plugin i18n
Reply
#16
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
Reply
#17
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
Reply
#18
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
Reply
#19
rather, try to work Smile
Reply




Users browsing this thread: 1 Guest(s)