e107inc / e107

e107 Bootstrap CMS (Content Management System) v2 with PHP, MySQL, HTML5, jQuery and Twitter Bootstrap. Issue Discussion Room: https://gitter.im/e107inc/e107
https://e107.org
GNU General Public License v3.0
318 stars 212 forks source link

[Question]: How should be parameter full used for e107::url()? #5140

Closed Jimmi08 closed 6 months ago

Jimmi08 commented 6 months ago

Question

I need to get the full url for some link.

I used the option "full"=>1 or full=1. It works in all plugin places except e_rss.php. Here has to be: "mode"=>"full" used.

So what is correct? "mode"=>"full" is only for RSS plugin?

Thanks

Expected Source

in forum plugin, e107_class and rss.php files. ,

Additional Context

The reason why it has to in full mode:

in rss.php (it must start with HTTP) otherwise weird URL is used.

                        if($row['link'])
                        {
                            if(stripos($row['link'], 'http') !== FALSE)
                            {
                                $this -> rssItems[$k]['link'] = $row['link'];
                            }
                            else
                            {
                                $this -> rssItems[$k]['link'] = SITEURLBASE.e_PLUGIN_ABS.$row['link'];
                            }
                        }
Moc commented 6 months ago

Documentation needs to be updated (https://devguide.e107.org/classes-and-methods/urls#example-2-using-optional-parameters) but you can use e107::url(), and then use the fourth parameter ($options) which is an array.

For example:

 $forum_url = e107::url("forum", "topic", $forum_data, array("mode" => "full"));

Background information: array('full' => 1) is applicable when usinge107::getUrl()->create() which I don't recommend at this point, unless you know what you are doing. It is used for some core routes, for example:

e107::getUrl()->create('news/view/item', $row, array('full' => 1));