I would like to modify SimpleNews to support named anchors in the newsletter. I am creating a long newsletter with a table of contents at the beginning. Drupal has trouble with named anchors, because it uses the home url as the base. So, to get the TOC links to work in Drupal, my anchors need to be path/to/newsletter#anchor. But when the newsletter is mailed out, the anchors need to be converted into just #anchor.
So, I want to do a search & replace pass on the html that goes out in the email.
Can you point me at the right place in the simplenews.module to start hacking?
thanks,
-tao starbow
Comments
Comment #1
starbow commentedActually, this turned out to be really easy to do.
I modifed simplenews_replace_vars to add a conditional %path valiable. Now I just write %path#anchor in the body of the newsletter.
function simplenews_replace_vars($node, $teaser = TRUE) {
global $base_url;
//replace %path only if not mailing
global $HTTP_GET_VARS;
$path = $HTTP_GET_VARS['q'];
if( ereg( "edit$", $path, $match ) ) {
$path = '';
}
$variables = array('%site' => variable_get('site_name', 'drupal'), '%uri' => $base_url, '%uri_brief' => substr($base_url, strlen\
('http://')), '%mymail' => $user->mail, '%date' => format_date(time()), '%login_uri' => url('user/login', NULL, NULL, TRUE), '%pat\
h' => $path );