1
recupsoft
Unable to display new field
  • 2003/11/1 9:34

  • recupsoft

  • Friend of XOOPS

  • Posts: 151

  • Since: 2003/10/30


I've added a new field (test=varchar200) into the xoops_mydownloads_downloads table.
Test must be an URL like homepage, in the same table.
Into templates_c/db%3Amydownloads_download.html
<?php echo $this->_tpl_vars['down']['homepage']; ?> is still working bring me an URL
but
<?php echo $this->_tpl_vars['down']['test']; ?> doesn't bring me the value of the field 'test'.
Solution ? Another file to edit ? Thanx.

2
Mithrandir
Re: Unable to display new field

try with the PHP file, which is fetching the data in the database
Are you sure the 'test' field is actually fetched?

Also, how do you modify the template?

3
recupsoft
Re: Unable to display new field
  • 2003/11/1 10:48

  • recupsoft

  • Friend of XOOPS

  • Posts: 151

  • Since: 2003/10/30


Field 'test' is ok, manually created and with URL using phpmyadmin into the table.
I only modified templates_c/db%3Amydownloads_download.html
but as it doesn't work
= lack of other modifications somewhere
maybe into a modules/mydownloads file
My problem is almost a standard one : How to add and display a new field ?
In that case with the mydownloads module... and I don't care about the language of the site etc... just want to work for everyone with my current template (templates_c).

4
Mithrandir
Re: Unable to display new field

well, as you explain it there, it sounds like you think a database field is retrieved automatically just by adding it to the table. It ain't. HTML files can't (AFAIK) connect to databases and fetch data, PHP files can - ergo there are one or more PHP files, you should edit to assign the 'test' field's value to a variable used in the template.

5
recupsoft
Re: Unable to display new field
  • 2003/11/1 11:41

  • recupsoft

  • Friend of XOOPS

  • Posts: 151

  • Since: 2003/10/30


That's what I understood and so that's what I'm lking for....
With my 'test' field and the use of mydownloads module, what must I still edit to display it

6
recupsoft
Re: Unable to display new field
  • 2003/11/4 19:53

  • recupsoft

  • Friend of XOOPS

  • Posts: 151

  • Since: 2003/10/30


Still no-one to help me to modify the code...

7
Herko
Re: Unable to display new field
  • 2003/11/4 20:17

  • Herko

  • XOOPS is my life!

  • Posts: 4238

  • Since: 2002/2/4 1


I have no specific answers for you, but I do know that editing the templates_c/ files isn't going to work, you'll need to edit the template itself using the system admin -> templates manager. Also, the code you called upon does not query the database, you'll have to look where the db values are pulled from the db amd add the value in the test field to the array created there. Then you can call it in the data presentation code and later in the template.

Herko

8
hsalazar
Re: Unable to display new field
  • 2003/11/4 20:44

  • hsalazar

  • Just popping in

  • Posts: 78

  • Since: 2003/2/6 1


recupsof:

The general procedure to use a field from a database table goes like this:

1) Either you add the field manually (as you did) or create the sql file to create it using XOOPS module installer. This just creates the field.

2) Modify whatever admin or site file is involved in the capture of data, so there's a form field whose content gets written in the relevant field in the database.

3) To retrieve and display the field, you need to:

a) Insert the retrieval logic in the PHP file, so there's a database query involved. This might have a syntax like:

$result = $xoopsDB->query('SELECT cid, title, url, homepage, test FROM '.$xoopsDB->prefix('xoops_mydownloads_downloads').' ORDER BY date ASC');

b) Once you retrieve the data, in the same PHP file create assignments so the PHP variable gets assigned to a Smarty variable. Something like

$xoopsTpl->assign('dl_test', $dl['test']);

(this, assuming you assigned the data to an array called $dl).

c) Make the necessary call in the template file. In this example, you'd need something like

<{$dl_test}>

This is all fictional, but the principle is correct. The steps are correct. It's just a matter of applying it to the real case.

Cheers.

9
recupsoft
Re: Unable to display new field
  • 2003/11/12 15:09

  • recupsoft

  • Friend of XOOPS

  • Posts: 151

  • Since: 2003/10/30


Thanx
I'm going to study that...

Login

Who's Online

225 user(s) are online (145 user(s) are browsing Support Forums)


Members: 0


Guests: 225


more...

Donat-O-Meter

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

Latest GitHub Commits