Author Topic: Need to add 2 new fileds in details page  (Read 17972 times)

0 Members and 1 Guest are viewing this topic.

Jacob

  • Guest
Need to add 2 new fileds in details page
« on: August 04, 2007, 08:39:38 PM »
Hello friends,

I want to add 2 new fileds in details page. I tried as written in tutorial by Jan but all vain.... :( don't know why

So, if  somebody please guide me how to add fields with a little more details, what to do.. what to add and where to add and exactly which sql query i need to run.

I want to add 2 two fields in details page and

1. It should be available to admin only. SO that i can fill the field from add or edit image from admin cp

2. If fields are empty, they should not appear on details page .. like no empty filed. like Keywords: ______

3. I need simple text box filed in which i can enter link to some image file.. not a drop down menu or option field.

Can somebody please guide me  :roll:

I am using v1.7.4

Thanks a lot friends for your kind help  :P

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: Need to add 2 new fileds in details page
« Reply #1 on: August 04, 2007, 09:07:38 PM »
Quote
1. It should be available to admin only. SO that i can fill the field from add or edit image from admin cp

From db_field_definitions.php file, no go axcept on hand in admin files direct.

Quote
2. If fields are empty, they should not appear on details page .. like no empty filed. like Keywords: ______

Yes, easy. IF condition need. ;)

Quote
3. I need simple text box filed in which i can enter link to some image file.. not a drop down menu or option field.

Easy. In includes/db_field_definitions.php file. Add some thing like:

Quote
$additional_image_fields['field1'] = array($lang['field1'], "text", 0);

In details.html file,

Quote
{field1}

where you want apper.

In lang/your_lang/main.php file, top of ?>,

Quote
$lang['field1'] = "Field 1";

Change field1 for field name of choice. ;)
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?

Jacob

  • Guest
Re: Need to add 2 new fileds in details page
« Reply #2 on: August 05, 2007, 05:06:02 AM »
Quote
1. It should be available to admin only. SO that i can fill the field from add or edit image from admin cp

From db_field_definitions.php file, no go axcept on hand in admin files direct.

Quote
2. If fields are empty, they should not appear on details page .. like no empty filed. like Keywords: ______

Yes, easy. IF condition need. ;)


Sorry i didn't get it  :?

Can you explain it little more clearly... like which <if> statement and what did you said in reply to my first question?

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: Need to add 2 new fileds in details page
« Reply #3 on: August 05, 2007, 05:47:58 AM »
Sorry for bad english ...

Quote
like which <if> statement

Say you enter 1 field in db_field_definitions.php file:

Quote
$additional_image_fields['field1'] = array($lang['field1'], "text", 0);

Can add if in target file:

Quote
if (!empty($additional_image_fields)) {
foreach ($additional_image_fields as $key => $val) {
if ($key == "field1") {
your arg here
}

break;
}

;)

Quote
what did you said in reply to my first question?

Answer cover in this post. ;)
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?

Offline n3w

  • Newbie
  • *
  • Posts: 26
    • View Profile
Re: Need to add 2 new fileds in details page
« Reply #4 on: August 09, 2007, 05:13:43 AM »
i also sorry for broken eng  :x

i want toask if i can add this in txt field ->> <a href=""></a> and <img src...

or should need some other filed other than txt field  :?:

hope ya git the point thunderstrike

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: Need to add 2 new fileds in details page
« Reply #5 on: August 09, 2007, 05:30:04 AM »
Quote
<a href=""></a>

To where and what do with field ?
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?

Offline n3w

  • Newbie
  • *
  • Posts: 26
    • View Profile
Re: Need to add 2 new fileds in details page
« Reply #6 on: August 09, 2007, 10:14:55 AM »
thunderstrike thank for replying

I want to make a filed like-

Photographer:  Test

so can you please suggest me how to do this, and i also want filed shold be available to admin control panel only

and
Quote
if (!empty($additional_image_fields)) {
foreach ($additional_image_fields as $key => $val) {
if ($key == "field1") {
your arg here
}
break;
}
where to add above code? in which file? and what is' your arg here'?

Sorry for asking these question, i am  newbie to 4images.. just installed 2 days back :)

Thanks for the help

Peace!

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: Need to add 2 new fileds in details page
« Reply #7 on: August 09, 2007, 02:45:38 PM »
No need code then.

Go to includes/db_field_definitions.php file,

add top of ?>:

Quote
$additional_image_fields['test'] = array($lang['test'], "text", 1);

In template (depen) and use:

Quote
{lang_test}
{test}

In lang/english/main.php, add top of ?>:

Quote
$lang['test'] = "Test";

Done. ;)
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?

Offline n3w

  • Newbie
  • *
  • Posts: 26
    • View Profile
Re: Need to add 2 new fileds in details page
« Reply #8 on: August 09, 2007, 03:38:20 PM »
Thank you thunderstrike .. i will try it after i have done template editing

if required, how can i want to remove this filed if there is no value.

Like if i enter no photograher name, than what? there will be a empty colum? How can i avid this blank filed.?

I really appreciate your help  :)
« Last Edit: August 09, 2007, 04:04:09 PM by n3w »

Offline n3w

  • Newbie
  • *
  • Posts: 26
    • View Profile
ERROR
« Reply #9 on: August 09, 2007, 04:02:31 PM »
ERROR-

Quote
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/muslimle/public_html/test/includes/db_mysql.php on line 116

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/muslimle/public_html/test/includes/db_mysql.php on line 116

After following your instructions, this is the error message that float on the top of the gallery and with this gallery says that there is not image! but I have about 20 images in the gallery

When i removed your code and re upload the file db_field_definitions.php, its works fine  :!:

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: Need to add 2 new fileds in details page
« Reply #10 on: August 09, 2007, 06:02:25 PM »
Quote
When i removed your code and re upload the file db_field_definitions.php, its works fine

No ! error from DB. Must add field in IMAGES_TABLE in phpmyadmin (forget say - sorry). ;)
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?

Offline n3w

  • Newbie
  • *
  • Posts: 26
    • View Profile
Re: Need to add 2 new fileds in details page
« Reply #11 on: August 10, 2007, 05:34:15 AM »

No ! error from DB. Must add field in IMAGES_TABLE in phpmyadmin (forget say - sorry). ;)

Ok :) then how to do that? How to add a field in IMAGE_TABLE?

Offline n3w

  • Newbie
  • *
  • Posts: 26
    • View Profile
Re: Need to add 2 new fileds in details page
« Reply #12 on: August 10, 2007, 09:10:06 AM »
Ok added new fields and working fine..

Now just help me to hide the fileds if they are empty

Quote
if (!empty($additional_image_fields)) {
foreach ($additional_image_fields as $key => $val) {
if ($key == "field1") {
your arg here
}

break;
}

Where to paste above code and what is this- your arg here?

Thank you


Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: Need to add 2 new fileds in details page
« Reply #13 on: August 10, 2007, 01:11:02 PM »
Chek for empty field:

Quote
if ($key == "field1" && strlen(trim($key)) == 0) {
your empty message here.
}

8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?

Offline n3w

  • Newbie
  • *
  • Posts: 26
    • View Profile
Re: Need to add 2 new fileds in details page
« Reply #14 on: August 10, 2007, 03:58:38 PM »
I just wanted this  :wink:

I thank you thunderstrike for helping me in this