Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: Customizing ecards  (Read 6538 times)

0 Members and 1 Guest are viewing this topic.

makk

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 24
    • the hid3out
Customizing ecards
« on: March 27, 2010, 03:06:24 am »

Hello.
I have been reading some old threads concerning customizing ecards templates, and thanks to a couple of those older threads I got the idea of making a new one for the theme I am using (theme RIN) since that one didn't have a custom ecard template!

I "borrowed" the one from sample theme and started to build both a front, and back! Now when I was trying it out for the first time I noticed in the ecard_template that there is no {RECIEVER}/[RECIPIENT] anywhere!

To show the card I  use

On Front:
{PIC_URL}

On back (left hand side)
{GREETINGS}
{MESSAGE}
{SENDER_NAME}

On back (right hand side)
{RECIPIENT_NAME}
{RECIPIENT_MAIL}


The two latter don't work for obvious reasons, but I wonder if there is anyway to show these anyway? I mean, I fill those two out when creating the ecard, and they are used as a reciever adress + reciever name in the email that is sent out!
I just thought it would look kinda nice, and almost like a real postcard with that feature

Attaching a screenie to show how my first attempt of creating a new look for the ecards became....

The original coppermine gallery is: http://private.htstart.org/

Thanks for your time!
Logged

Nibbler

  • Guest
Re: Customizing ecards
« Reply #1 on: March 27, 2010, 12:53:34 pm »

You need to modify Coppermine itself to accomplish this. Open ecard.php and look for the template params here

Code: [Select]
    $params = array('{LANG_DIR}' => $lang_text_dir,
        '{TITLE}' => sprintf($lang_ecard_php['ecard_title'], $sender_name),
        '{CHARSET}' => $CONFIG['charset'] == 'language file' ? $lang_charset : $CONFIG['charset'],
        '{VIEW_ECARD_TGT}' => "{$gallery_url_prefix}displayecard.php?data=$encoded_data",
        '{VIEW_ECARD_LNK}' => $lang_ecard_php['view_ecard'],
        '{VIEW_ECARD_LNK_PLAINTEXT}' => $lang_ecard_php['view_ecard_plaintext'],
        '{PIC_URL}' => $n_picname,
        '{URL_PREFIX}' => $gallery_url_prefix,
        '{GREETINGS}' => $greetings,
        '{MESSAGE}' => bb_decode($msg_content),
        '{PLAINTEXT_MESSAGE}' => $message,
        '{SENDER_EMAIL}' => $sender_email,
        '{SENDER_NAME}' => $sender_name,
        '{VIEW_MORE_TGT}' => $CONFIG['ecards_more_pic_target'],
        '{VIEW_MORE_LNK}' => $lang_ecard_php['view_more_pics'],
        '{PID}' => $pid,
        '{PIC_TITLE}' => $pic_title,
        '{PIC_CAPTION}' => $pic_caption,
        );

Add in the new ones at the end, like so:

Code: [Select]
    $params = array('{LANG_DIR}' => $lang_text_dir,
        '{TITLE}' => sprintf($lang_ecard_php['ecard_title'], $sender_name),
        '{CHARSET}' => $CONFIG['charset'] == 'language file' ? $lang_charset : $CONFIG['charset'],
        '{VIEW_ECARD_TGT}' => "{$gallery_url_prefix}displayecard.php?data=$encoded_data",
        '{VIEW_ECARD_LNK}' => $lang_ecard_php['view_ecard'],
        '{VIEW_ECARD_LNK_PLAINTEXT}' => $lang_ecard_php['view_ecard_plaintext'],
        '{PIC_URL}' => $n_picname,
        '{URL_PREFIX}' => $gallery_url_prefix,
        '{GREETINGS}' => $greetings,
        '{MESSAGE}' => bb_decode($msg_content),
        '{PLAINTEXT_MESSAGE}' => $message,
        '{SENDER_EMAIL}' => $sender_email,
        '{SENDER_NAME}' => $sender_name,
        '{VIEW_MORE_TGT}' => $CONFIG['ecards_more_pic_target'],
        '{VIEW_MORE_LNK}' => $lang_ecard_php['view_more_pics'],
        '{PID}' => $pid,
        '{PIC_TITLE}' => $pic_title,
        '{PIC_CAPTION}' => $pic_caption,
        '{RECIPIENT_NAME}' => $data['rn'],
        '{RECIPIENT_MAIL}' => $recipient_email
        );
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Customizing ecards
« Reply #2 on: March 27, 2010, 03:48:38 pm »

[off topic]
You really should disable the display of the vanity icons, as your custom theme doesn't validate at all. Additionally, as BOM (byte order mark) has crept into one of your files, so you better fix that as well.
[/off topic]
Logged

makk

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 24
    • the hid3out
Re: Customizing ecards
« Reply #3 on: March 27, 2010, 06:24:27 pm »

Thanks very much Joachim. Will try that out as soon as my son lets me use the computer for more than 10 minutes :)

And thanks about the validator-remark. I guess I modified the theme to much and kinda broke that one!
The latter BOM-part I have actually no idea what it refer to or even mean, but since it's a validator issue, I will try and fix it, or simply remove the validator link saying the site runs like that!

[will be back to hopefully solve the thread later on]

/Michael
Logged

makk

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 24
    • the hid3out
Re: Customizing ecards
« Reply #4 on: March 27, 2010, 06:57:51 pm »

Well atleast semi-solved :)
The email sent looks good (after I fixed the template that was really not good at all I noticed) and the recipients name and adress are shown on the ecard in the mail! I can't get it to show up on the webpage though! Maybe that's just a minor fault by me. Will re-check later tonight.

Thanks for now
Logged

makk

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 24
    • the hid3out
Re: Customizing ecards
« Reply #5 on: March 28, 2010, 02:04:41 am »

You need to modify Coppermine itself to accomplish this.[....]

Had only 50% luck with that though and I am kind of an "glass is half full " kinda guy, I guess that's something =)
It works in the email and I see the recipients name and adress (as on a regular postcard) but still only show up like {RECIPIENT_NAME} on the webpage (/displayecard.php?data=verylongstringcombo.........)

**5 minutes later**

Ahh, coin dropped :)
I needed to do the same in the displayecard.php of course. But.....

1. When I create the ecard and I see the preview (or after sending) I see it correct, with name + recipients adress on correct contents!
2. In the mail I also see this correct (the html is screwed up a bit in that's is a completely other issue) as it should be. All contents intact!
3. When clicking on the link getting me to the webadress of /displayimage.php?data=verylongstring, the recipients address is blank though!

Have a testaccount (tester/tester) which I believe can send ecards and vote


added in both ecard.php & displayecard.php:
Code: [Select]
    '{RECIPIENT_NAME}' => $data['rn'],
    '{RECIPIENT_EMAIL}' => $recipient_email

the latter part of the theme output (the back of the card):

Code: [Select]
<table style="border: 1px solid rgb(204, 204, 204); padding: 10px; background-color: rgb(255, 255, 255); background-image:url('http://private.htstart.org/themes/rin/images/ecard_back.png');" width="600" height="500" cellpadding="3" cellspacing="3">
<tr>
<td rowspan="3" width="300" valign="top"><strong>{GREETINGS}</strong><br><br>{MESSAGE}</td>
<td width="300" height="140" align=right valign="top"><img src="http://private.htstart.org/themes/rin/images/stamp.png"></td>
</tr>
<tr>
<td valign="middle">&nbsp;&nbsp;&nbsp; {RECIPIENT_NAME}</td>
</tr>
<tr>
<td valign="top">&nbsp;&nbsp;&nbsp; {RECIPIENT_EMAIL}</td>
</tr>
<tr>
<td valign="top" align="right"><b>/{SENDER_NAME}</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
<td></td>
</tr>
</table>


And yes I changed the "{RECIPIENT_EMAIL}" in to that from just {RECIPIENT_MAIL} in all places. It works in preview mode, email mode, but not on actual web visit mode!
Logged

Nibbler

  • Guest
Re: Customizing ecards
« Reply #6 on: March 28, 2010, 11:09:58 am »

Yeah, that's because the recipient address is not actually recorded in the ecard data. You'll need to add that in in ecard.php here

Code: [Select]
    $data = array('rn' => $_POST['recipient_name'],
        'sn' => $_POST['sender_name'],
        'se' => $sender_email,
        'p' => $n_picname,
        'g' => $greetings,
        'm' => $message,
        'pid' => $pid,
        'pt' => $pic_title,
        'pc' => $pic_caption,
        );

So it becomes

Code: [Select]
    $data = array('rn' => $_POST['recipient_name'],
        'sn' => $_POST['sender_name'],
        'se' => $sender_email,
        'p' => $n_picname,
        'g' => $greetings,
        'm' => $message,
        'pid' => $pid,
        'pt' => $pic_title,
        'pc' => $pic_caption,
        're' => $recipient_email,
        );

Then the template code becomes

Code: [Select]
    '{RECIPIENT_NAME}' => $data['rn'],
    '{RECIPIENT_EMAIL}' => $data['re']

in both in ecard.php and displayimage.php. Note that this will only work for ecards created after you make the change.
Logged

makk

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 24
    • the hid3out
Re: Customizing ecards
« Reply #7 on: March 28, 2010, 03:22:56 pm »

Thank you very much Nibbler!
Case closed, thread solved!
Logged
Pages: [1]   Go Up
 

Page created in 0.021 seconds with 19 queries.