ucla-oarc-mobile / mwf

UCLA Mobile Web Framework
http://mwf.ucla.edu
Other
86 stars 25 forks source link

How to override footer links on per page basis #160

Closed BerkeleyEdu closed 1 year ago

BerkeleyEdu commented 12 years ago

Hi,

In MWF 1.2 I set the link in the footer to current file to blank so that it would not be underlined or linked. This is done for usability.

$footer->set_contact('', ''); echo $footer->render();

but this no longer works because all of the footer links are in one array (private $_footer_link_urls) whereas before they we separate (private $_contact_url = '/contact';) so, how can I get this functionality back?

-Sara

ebollens commented 12 years ago

I'm a bit confused what you mean by "in the footer to current file to blank so that it would not be underlined or linked"

As for front page links, you can control them in config/global.ini.

BerkeleyEdu commented 12 years ago

For example on the production site, the footer in the Contact page does not have a the "Contact" in the footer as a hot link:

http://m.berkeley.edu/contact/

Linking to the current page is considered bad for usability.

-Sara

On 8/31/2012 4:54 PM, Eric Bollens wrote:

I'm a bit confused what you mean by "in the footer to current file to blank so that it would not be underlined or linked"

As for front page links, you can control them in |config/global.ini|.

— Reply to this email directly or view it on GitHub https://github.com/ucla/mwf/issues/160#issuecomment-8208008.

Sara Leavitt, Electronic Communications Specialist UC Berkeley Office of Public Affairs 2200 Bancroft Way, Berkeley, CA 94720-4204 Phone: 510 643-6163 http://events.berkeley.edu http://www.berkeley.edu/mobile

ebollens commented 12 years ago

To change this, you'd need to override the class Default_Footer_Site_Decorator with your own that has custom behaviors. You could simply program it to use the old method instead.

Trott commented 12 years ago

Untested, but if you know the URL you want to remove from the footer (but leave the associated text intact), I think you'd do something like this prior to rendering the footer:

function remove_link( $title ) {
    $footer_link_titles = Config::get('global', 'footer_link_titles');
    $footer_link_urls = Config::get('global', 'footer_link_urls');
    $found = array_search($title, $footer_link_titles);
    if ($found !== FALSE) {
        unset($footer_link_urls[$found]);
    }
   Config::set('global', 'footer_link_urls', $footer_link_urls);
}

I'm pretty sure that, or something very close to that, should work. Like I said, untested, sorry. But calling remove_link('Contact') before the render() call on the footer should remove the link (but leave the text).

BerkeleyEdu commented 12 years ago

Hi Rich,

Thanks for the hint! The "unset" messed up the for loop in footer.class.php so I set the link to 'link_removed' then test later to see if a link should be rendered.

public function &remove_link( $title ) { $found = array_search($title, $this->_footer_link_titles); if ($found !== FALSE) { $this->_footer_link_urls[$found] = 'link_removed'; } return $this; } ... for ($i = 0; $i < count($this->_footer_link_urls); $i++) { if ($this->_footer_link_urls[$i] == 'link_removed') { $p->add_inner($this->_footer_link_titles[$i]); } else { $p->add_inner_tag('a', $this->_footer_link_titles[$i], array('href' => $this->_footer_link_urls[$i]));

On 8/31/12 6:23 PM, Trott wrote:

Untested, but if you know the URL you want to remove from the footer (but leave the associated text intact), I think you'd do something like this prior to rendering the footer:

function remove_link( $title ) { $footer_link_titles = Config::get('global', 'footer_link_titles'); $footer_link_urls = Config::get('global', 'footer_link_urls'); $found = array_search($title, $footer_link_titles); if ($found !== FALSE) { unset($footer_link_urls[$found]); } Config::set('global', 'footer_link_urls', $footer_link_urls); }

I'm pretty sure that, or something very close to that, should work. Like I said, untested, sorry. But calling |remove_link('Contact')| before the |render()| call on the footer should remove the link (but leave the text).

— Reply to this email directly or view it on GitHub https://github.com/ucla/mwf/issues/160#issuecomment-8208908.

rrocchio commented 1 year ago

Closing this issue as this system has long since been deprecated.