开发者

Friendly URL in Drupal to a PDF that is buried deep in a module?

开发者 https://www.devze.com 2023-01-16 09:04 出处:网络
I have a PDF burried in a module (sites/all/modules/mymodule/开发者_如何学运维pdf/userguide.pdf)....how do i make it a friendly url like (sitename.com/mymodule/userguide.pdf)?or in your module code ne

I have a PDF burried in a module (sites/all/modules/mymodule/开发者_如何学运维pdf/userguide.pdf)....how do i make it a friendly url like (sitename.com/mymodule/userguide.pdf) ?


or in your module code next:

/**
 * Implementation of hook_menu()
 */
function mymodule_menu() {
  $items['mymodule'] = array(
    'page callback' => 'mymodule_pdf',
    'type' => MENU_CALLBACK,
    'access arguments' => array('access content'),
    'page arguments' => array(1),
  );
  ...
  return $items;
}

function mymodule_pdf ($filename) {
// function that will upload generated $filename.pdf
}

p.s. Also you can try add alias via path module, map: sites/all/modules/mymodule/pdf/userguide.pdf to mymodule/userguide.pdf...

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号