Author Topic: html or bbcode in additional db fields?  (Read 19528 times)

0 Members and 1 Guest are viewing this topic.

Offline sigma

  • Full Member
  • ***
  • Posts: 127
    • View Profile
    • http://cydonian.com
html or bbcode in additional db fields?
« on: January 22, 2006, 11:39:45 PM »
Is it possible to enable html or bbcode for additional fields? These are Image Description fields. I would like to have a bit of html code in a new field I added.

Anyone know if this is possible?

Offline mawenzi

  • 4images Moderator
  • 4images Guru
  • *****
  • Posts: 4.500
    • View Profile
Re: html or bbcode in additional db fields?
« Reply #1 on: January 23, 2006, 10:41:29 AM »
... in $action == "save";  ...
Code: [Select]
$your_field= un_htmlspecialchars(trim($HTTP_POST_VARS['your_field']));
Your first three "must do" before you ask a question ! ( © by V@no )
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

You are on search for top 4images MOD's ?
- then please search here ... Mawenzi's Top 100+ MOD List (unsorted sorted) ...

Offline sigma

  • Full Member
  • ***
  • Posts: 127
    • View Profile
    • http://cydonian.com
Re: html or bbcode in additional db fields?
« Reply #2 on: January 23, 2006, 04:08:18 PM »
ahhh, interesting. Thanks mawenzi. So if my field is like this...

Code: [Select]
$additional_image_fields['image_location'] = array($lang['user_im_location'], "text", 0);
Would it look something like this then?

Code: [Select]
additional_image_fields['image_location']= un_htmlspecialchars(trim($HTTP_POST_VARS['user_im_location']));
what about the lang reference?



Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: html or bbcode in additional db fields?
« Reply #3 on: January 24, 2006, 03:17:21 AM »
By default HTML is allowed in custom fields. Maybe you've changed something in the code that turned it off..
make sure in includes/functions.php you have this line:
Code: [Select]
      $additional_field_array[$key] = (!empty($image_row[$key])) ? format_text($image_row[$key], 1) : REPLACE_EMPTY;
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline sigma

  • Full Member
  • ***
  • Posts: 127
    • View Profile
    • http://cydonian.com
Re: html or bbcode in additional db fields?
« Reply #4 on: January 24, 2006, 03:19:00 PM »
html works but it totally breaks the template.

Am I supposed to use something like <html></html> to keep it enclosed?

btw. That line is present in my functions.php

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: html or bbcode in additional db fields?
« Reply #5 on: January 24, 2006, 03:31:25 PM »
You are trying to display some html code inside template's HTML...so what <html></html> are you talking about? ;) see my point?
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline sigma

  • Full Member
  • ***
  • Posts: 127
    • View Profile
    • http://cydonian.com
Re: html or bbcode in additional db fields?
« Reply #6 on: January 24, 2006, 04:48:42 PM »
heres what ive tried to do.

In the new text field I tried to put the following..

<a href="http://cydonian.com/blahblahblah.htm>My Link</a>

but it breaks the template. How do I prevent this from happening?

Offline TheOracle

  • Hero Member
  • *****
  • Posts: 875
    • View Profile
Re: html or bbcode in additional db fields?
« Reply #7 on: January 24, 2006, 04:56:23 PM »
Quote

<a href="http://cydonian.com/blahblahblah.htm>My Link</a>


should be :

Code: [Select]

<a href="http://cydonian.com/blahblahblah.htm">My Link</a>


;)

Offline sigma

  • Full Member
  • ***
  • Posts: 127
    • View Profile
    • http://cydonian.com
Re: html or bbcode in additional db fields?
« Reply #8 on: January 24, 2006, 06:21:49 PM »
yes, my mistake. typo. doesnt solve the problem.
;)

Offline TheOracle

  • Hero Member
  • *****
  • Posts: 875
    • View Profile
Re: html or bbcode in additional db fields?
« Reply #9 on: January 24, 2006, 06:46:13 PM »
If you intend to use links within HTML files, that's not a bad solution but also not the best one.

Meaning, when I wish to add a link, I implement it within my PHP files. Then, I simply create a new initial tag within my templates.

In the end, the link becomes like this :

Code: [Select]

<a href="{my_link}">{lang_my_link}</a>


;)

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: html or bbcode in additional db fields?
« Reply #10 on: January 25, 2006, 12:38:10 AM »
yes, my mistake. typo. doesnt solve the problem.
;)
So, what exactly does it do? can we see it in action?
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline sigma

  • Full Member
  • ***
  • Posts: 127
    • View Profile
    • http://cydonian.com
Re: html or bbcode in additional db fields?
« Reply #11 on: January 25, 2006, 05:36:26 AM »
sure. heres a screenshot after saving the html in the field within the ACP.

The template in the details.htm looks fine now after fixing the typo (missing ") but the problem with the field in the Admin Control Panel is still there.

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: html or bbcode in additional db fields?
« Reply #12 on: January 25, 2006, 06:11:11 AM »
Its because you should use textarea type of the field and not text in db_field_definitions.php
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline sigma

  • Full Member
  • ***
  • Posts: 127
    • View Profile
    • http://cydonian.com
Re: html or bbcode in additional db fields?
« Reply #13 on: January 25, 2006, 02:32:55 PM »
thanks v@no. also Oracle and mawenzi for helpin out.
Where do you guys learn this stuff? Where does it say 'use textarea if using html'?
I just wish i could figure this stuff out for myself insted of buggin you guys all the time.

Its working fine now.

Now all I have to do Is find a way to show this field ONLY to registered members.

Offline mawenzi

  • 4images Moderator
  • 4images Guru
  • *****
  • Posts: 4.500
    • View Profile
Re: html or bbcode in additional db fields?
« Reply #14 on: January 25, 2006, 02:42:32 PM »
Now all I have to do Is find a way to show this field ONLY to registered members.

Code: [Select]
{if user_loggedin}{location_map}{endif user_loggedin}
Your first three "must do" before you ask a question ! ( © by V@no )
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

You are on search for top 4images MOD's ?
- then please search here ... Mawenzi's Top 100+ MOD List (unsorted sorted) ...