How do I link to an Anchor in an article?

In this board you can talk about general questions about phpMyFAQ

Moderator: Thorsten

Thorsten
Posts: 15560
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: How do I link to an Anchor in an article?

Post by Thorsten »

Hi,

I'll check thi issue.

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
Lidio
Posts: 25
Joined: Mon Dec 10, 2007 9:26 pm

Re: How do I link to an Anchor in an article?

Post by Lidio »

Thorsten wrote:Hi,

I'll check thi issue.

bye
Thorsten
Hi Thorsten,

here is my patch for consideration.

in inc/link.php added fragment test and save the fragment

Code: Select all

    protected function getHttpGetParameters()
    {
        $query      = $this->getQuery();
        $parameters = array();

        if (!empty($query)) {
            if ( isset($query['fragment']) ) {
            	$parameters[self::PMF_LINK_FRAGMENT_SEPARATOR] = urldecode($query['fragment']);
            }
            $params = explode(self::PMF_LINK_AMPERSAND, $query['main']);
            foreach ($params as $param) {
                if (!empty($param)) {
                    $couple           = explode(self::PMF_LINK_EQUAL, $param);
                    list($key, $val)  = $couple;
                    $parameters[$key] = urldecode($val);
                }
            }
        }

        return $parameters;
    }
in public function toString(...) added check for fragment and append to new url

Code: Select all

                        case self::PMF_LINK_GET_ACTION_ARTIKEL:
                            $url .= self::PMF_LINK_CONTENT.$getParams[self::PMF_LINK_GET_CATEGORY].self::PMF_LINK_HTML_SLASH.$getParams[self::PMF_LINK_GET_ID].self::PMF_LINK_HTML_SLASH.$getParams[self::PMF_LINK_GET_ARTLANG].self::PMF_LINK_SLASH.$this->getSEOItemTitle().self::PMF_LINK_HTML_EXTENSION;
                            if (isset($getParams[self::PMF_LINK_GET_HIGHLIGHT])) {
                                $url .= self::PMF_LINK_SEARCHPART_SEPARATOR.self::PMF_LINK_GET_HIGHLIGHT.'='.$getParams[self::PMF_LINK_GET_HIGHLIGHT];
                            }
                            if ( isset($getParams[self::PMF_LINK_FRAGMENT_SEPARATOR]) ) {
                                $url .= self::PMF_LINK_FRAGMENT_SEPARATOR.$getParams[self::PMF_LINK_FRAGMENT_SEPARATOR];
                            }
                            break;
Regards,

Lidio.
Thorsten
Posts: 15560
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: How do I link to an Anchor in an article?

Post by Thorsten »

Hi,

I reviewed your patch and it looks good. I'll add it to 2.6.8. Thanks!

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
hprosupp
Posts: 7
Joined: Tue Nov 28, 2017 2:35 pm

Re: How do I link to an Anchor in an article?

Post by hprosupp »

Hi,

I have the same issue on my fresh from today install (2.9.9 on CentOS 7)

When i edit my article it sounds ok but when i'm on my faq the link is http://my.domain.name/faq/#anchor and obviously it doesn't work.

mod_rewrite is disabled

can someone help ?

Best regards,

Hprosupp
Thorsten
Posts: 15560
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: How do I link to an Anchor in an article?

Post by Thorsten »

Hi,

how do you add the anchors?

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
hprosupp
Posts: 7
Joined: Tue Nov 28, 2017 2:35 pm

Re: How do I link to an Anchor in an article?

Post by hprosupp »

Thorsten wrote: Tue Nov 28, 2017 8:57 pm Hi,

how do you add the anchors?

bye
Thorsten
Hi,

I'm using the editor : Insert > Anchor after selecting my text

And then i use the "link" tool on the top content of my page
hprosupp
Posts: 7
Joined: Tue Nov 28, 2017 2:35 pm

Re: How do I link to an Anchor in an article?

Post by hprosupp »

Anyone can help ?
Thorsten
Posts: 15560
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: How do I link to an Anchor in an article?

Post by Thorsten »

Hi,

I'll check it.

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
hprosupp
Posts: 7
Joined: Tue Nov 28, 2017 2:35 pm

Re: How do I link to an Anchor in an article?

Post by hprosupp »

Thorsten wrote: Fri Dec 08, 2017 10:24 pm Hi,

I'll check it.

bye
Thorsten
Hi, have any answer for me ?
Thorsten
Posts: 15560
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: How do I link to an Anchor in an article?

Post by Thorsten »

Hi,

not yet.

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
hprosupp
Posts: 7
Joined: Tue Nov 28, 2017 2:35 pm

Re: How do I link to an Anchor in an article?

Post by hprosupp »

Hi,

So what can i do ?

Best regards and happy new year !
Post Reply