81
tzvook
Re: Using HTML in Mail Users under System?
  • 2009/3/26 18:36

  • tzvook

  • Just can't stay away

  • Posts: 875

  • Since: 2003/2/1 2


Just a quick note !!!
If you use the PM option in the mail-users admin, you'll find out that you PM module is non-HTML enable.

There is a fix for that too, but, well, I simply recommend using "mpmanager" module instead of the (XXXXXX) pm module ... which solves the issue.



82
tzvook
Re: Using HTML in Mail Users under System?
  • 2009/3/26 17:10

  • tzvook

  • Just can't stay away

  • Posts: 875

  • Since: 2003/2/1 2


OK folks - tested with 2.3.3 and is working fine

(I may add system-wide wysiwyg editor capability later on, but for now it works with TinyEditor/Inbetween which is my favorite by far)

I Took an old hack by sceilig with a few fixes and line corrections by me, and adopted it to XOOPS 2.3.3 with a few small changes (quoting a lot from the original thread) :

The XoopsMailer class builds upon the powerful phpmailer email class - this can be used to send emails as text, html or with multipart attachments.

The default setting for content-type in that class is "text/plain" which is why all XOOPS mails go out as text.

This is a quick hack to allow XOOPS to control the content-type setting per instance of using the XoopsMailer. So say for most emails being sent out (like forgot password, change email etc) they could appear as text, but if I wanted to have the "Mail Users" admin function send emails as html, I did the following hacks.

1. edit class/xoopsmailer.php and at line 96 (just above var $subject) add a contentType variable

// TZ added for HTML mailing //
     // private
     
var $contentType;
            
// END TZ Addition  //


2. in the same file around line 233 (just above setSubject())

// TZ added for HTML mailing //
    // public
    
function setContentType($value)
    {
    if (
$value$this->contentType trim($value);
    }
            
// END TZ Addition  //


3. in the same file around line 420 (just after ($this->encoding)

// TZ added for HTML mailing //
        
$this->multimailer->ContentType $this->contentType;
            
// END TZ Addition  //


4. Now depending on what module you are using for sending emails to users, you add a couple of fields to your $xoopsMailer instance.
e.g. for sending html emails using the main "Mail Users" administration function, edit this file:
modules/system/admin/mailusers/mailusers.php

At line 147 ( $xoopsMailer =& xoops_getMailer(); )
add this lines:

// TZ added for HTML mailing //
            
$xoopsMailer->setContentType("text/html");
            
$xoopsMailer->setTemplate('mailusers.tpl');
            
$xoopsMailer->assign('X_SITENAME'$xoopsConfig['sitename']);
            
$xoopsMailer->assign('X_SITEURL'XOOPS_URL."/");
            
$xoopsMailer->assign('X_MESSAGE'$myts->oopsStripSlashesGPC($_POST['mail_body']));
            
// END TZ Addition  //


What Im doing here is setting the ContentType to be text/html. Then using a mail template I created called 'mailusers.tpl'. This template (stored in language/english/mail_template/) is essentially a html file containing my website header and footer, as well as XOOPS placeholders for the content of the email (X_MESSAGE) and Name of the website.

This would be a simple example of that template:

Quote:


<html>
<body>
<div style="margin-left: 20px; margin-right:20px;">
{X_MESSAGE}
<br />
<br />
-------------------------------------<br />
Please do not reply to this message.<br />
-------------------------------------<br/ >
<br />
{X_SITENAME}<br />
<A href='{X_SITEURL}'>{X_SITEURL}</a><br />
</div>
</body>
</html>

=================================================================

5. Implement a html editor for creating the body of the email like inbetween or fckeditor.

For the "Mail Users" function, you would edit modules/system/admin/mailusers/mailform.php
then uncomment line 82 ($body_text = new XoopsFormTextArea ......)
and put this call to the Inbetween editor instead

// TZ added for HTML mailing //
include_once(XOOPS_ROOT_PATH "/class/xoopseditor/inbetween/forminbetweentextarea.php");
$body_text = (new XoopsFormInbetweenTextArea(array('caption'=> $body_caption'name'=>'mail_body''value'=>$mail_body'width'=>'100%''height'=>'250px'),true));
            
// END TZ Addition  //


for tinyeditor turn it into:
// $body_text = new XoopsFormTextArea($body_caption, "mail_body", "", 10);

            // TZ added for HTML mailing //
include_once(XOOPS_ROOT_PATH "/class/xoopseditor/tinyeditor/formtinyeditortextarea.php");
$body_text = (new XoopsFormtinyeditorTextArea(array('caption'=> $body_caption'name'=>'mail_body''value'=>$mail_body'width'=>'100%''height'=>'250px'),true));
            
// END TZ Addition  //


NOW - a call to devs - I "cleaned the dust" after 3 years from the original thread, please !!! add it to the core !!!

I can't see my sites without this hack and am tired to apply it to each version that comes out - it a must have one and ... well enough said ...

as said b4 - If not intended to the core - I plan to add system-wide editors to this ...

For small to medium sites - this hack is upgrading the mail-users features quite nicely instead of a mailinglist.




83
tzvook
Re: Using HTML in Mail Users under System?
  • 2009/3/26 16:01

  • tzvook

  • Just can't stay away

  • Posts: 875

  • Since: 2003/2/1 2


Quote:

Mamba wrote:
Quote:
This one should have long ago enter the core

If it works, can you add it to "Feature Request"?

Thanks...


As you can read here
I asked this 3 years ago - and indeed - as I said b4 - all mail clients support HTML - it's a shame XOOPS is still so many years back with mailing users, this feature is just the "tip of the iceberg", but it's a start .

Anyway - I got home and am going to get it to work with 2.3.3 !!!



84
tzvook
Re: Using HTML in Mail Users under System?
  • 2009/3/26 13:18

  • tzvook

  • Just can't stay away

  • Posts: 875

  • Since: 2003/2/1 2


Since this one :https://xoops.org/modules/newbb/viewtopic.php?post_id=289857#forumpost289857 is not working for me with 2.3.3 , I'll locate a 3 years old hack and try to make it work with the current version ....

This one should have long ago enter the core .... any email client support HTML , Sending your users text is ridiculous ...

All my 2.2.4 sites has this hack (slightly moded version), I'll be back with the solution - I hope

==================== edit ===============
Found it - send email with html to site members

I'll try and see if it works with 2.3.3 .... later today



85
tzvook
Re: Ajax autocompletion feeded with isearch module
  • 2009/3/20 19:36

  • tzvook

  • Just can't stay away

  • Posts: 875

  • Since: 2003/2/1 2


BUMP

Trabis - any news ?
can't wait to see the "terms" working ...
Have you seen the "double" keyword effect? am I the only one experiencing it ? ... each "word" is getting doubled ...



86
tzvook
Re: New module: Timeline
  • 2009/3/20 13:04

  • tzvook

  • Just can't stay away

  • Posts: 875

  • Since: 2003/2/1 2


Good idea, will be a very useful module, widening XOOPS use possibilities.
(attaching text + photos to events, etc' ..)



87
tzvook
Re: Ajax autocompletion feeded with isearch module
  • 2009/3/18 15:41

  • tzvook

  • Just can't stay away

  • Posts: 875

  • Since: 2003/2/1 2


One more thing T

@ /templates/blocks/mysearch_block_last_search.html

<{foreach item=onesearch from=$block.searches}>
    <
tr class="<{cycle values="even,odd"}>"><td align='center'><{$onesearch.keyword}></a></td></tr>
<{/foreach}>


should be:
<{foreach item=onesearch from=$block.searches}>
    <
tr class="<{cycle values="even,odd"}>"><td align='center'><{$onesearch.link}><{$onesearch.keyword}></a></td></tr>
<{/foreach}>


Along with ( /blocks/mysearch_last_search.php ) :
$search['link'] = "<a href='".XOOPS_URL.'/search.php?query='.$oneelement->getVar('keyword')."&action=results' target='_blank'>";


Turning into this:
$search['link'] = "<a href='".XOOPS_URL.'/modules/mysearch/search.php?query='.$oneelement->getVar('keyword')."&action=results'>";


And in this line ( a bit above ) I needed to hard code it - so it probably should also be a block $var

$critere->setSort('datesearch');
// TZ for hard-coded limit        $critere->setLimit($visiblekeywords);
        
$critere->setLimit(5);


Since it's taking the $visiblekeywords from the module-wide preferences also for the block.

I didn't looked on all the blocks, just on this one ...



88
tzvook
Re: Ajax autocompletion feeded with isearch module
  • 2009/3/16 15:47

  • tzvook

  • Just can't stay away

  • Posts: 875

  • Since: 2003/2/1 2


Forgot one thing:

in this part:
<script>
insertVideos('youtubeDiv','search','<{section name=cur_kw_searched loop=$searched_keywords}><{$searched_keywords[cur_kw_searched]}><{if $smarty.section.cur_kw_searched.index <>$smarty.section.cur_kw_searched.total}> <{/if}><{/section}>','10',1);
</
script>


The no. 10 represents the clips no. and can be a $var of course



89
tzvook
Re: Ajax autocompletion feeded with isearch module
  • 2009/3/16 15:40

  • tzvook

  • Just can't stay away

  • Posts: 875

  • Since: 2003/2/1 2


Sorry trabis - I 4got about it, but here it is now

First of all here is the JS + CSS (kept it @ your module structure, and I'm 99.9% sure there's no hardcoded staff in it).
http://www.gifts45.com/tmp/mysearch.zip

@ /templates/mysearch_search.html I added ( before the <{$label_ignored_keywords}> section )

<link rel="stylesheet" type="text/css" href="css/lightwindow.css" />
<!-- 
JavaScript -->
<
script type="text/javascript" src="js/inthetube/prototype.js"></script>
<
script type="text/javascript" src="js/inthetube/effects.js"></script>
<
script type="text/javascript" src="js/inthetube/lightwindow.js"></script>
<
link href="css/inTHEtube.css" rel="stylesheet" type="text/css" media="screen" />
<
script src="js/inthetube/inTHEtube.js" type="text/javascript"></script>

<
p>
<!-- 
Start video results -->
<
h2>Youtube video clips for: <{section name=cur_kw_searched loop=$searched_keywords}>
<{
$searched_keywords[cur_kw_searched]}><{if $smarty.section.cur_kw_searched.index <> $smarty.section.cur_kw_searched.total}>&nbsp;<{/if}><{/section}></h2>
<
center><div id="youtubeDiv" style="display: block; clear: both">
</
div></center>
<
script>
insertVideos('youtubeDiv','search','<{section name=cur_kw_searched loop=$searched_keywords}><{$searched_keywords[cur_kw_searched]}><{if $smarty.section.cur_kw_searched.index <>$smarty.section.cur_kw_searched.total}> <{/if}><{/section}>','10',1);
</
script>
<!-- 
End your keywords results -->
</
p>



90
tzvook
Re: Ajax autocompletion feeded with isearch module
  • 2009/3/13 15:43

  • tzvook

  • Just can't stay away

  • Posts: 875

  • Since: 2003/2/1 2


Most of my sites are still 2.2. since my 2.2. version was heavily modified, but the new one are 2.3.x (definately) ...
The code is client side anyway, I'm not @ home today, so I'll send it tomorrow from home ...




TopTop
« 1 ... 6 7 8 (9) 10 11 12 ... 60 »



Login

Who's Online

180 user(s) are online (106 user(s) are browsing Support Forums)


Members: 0


Guests: 180


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Mar 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits