Adjusting filelist template

Get help with installation and running phpwcms here. Please do not post bug reports or feature requests here.
Post Reply
p0ldi
Posts: 3
Joined: Wed 1. Apr 2009, 15:00

Adjusting filelist template

Post by p0ldi » Wed 1. Apr 2009, 15:10

Hi there!

I have searched the forum and net for a while but could not find an answer to this: I am running phpwcms 1.4.1 and have a query regarding the filelist template. I want the template to display the description, which is stored in column "f_longinfo" of the database, textfield "Long info" (or "Info" when logging on in german) in the backend.

The default.html contains the following entry, that looked promising:

Code: Select all

[FILE_DESCRIPTION]{FILE_DESCRIPTION}[/FILE_DESCRIPTION]
Unfortunately this does not return any value for my files, even though I filled all available backend fields. As I do not know where to find the mapping of parameters to table columns (I did a full-text search but was not able to find any of the ones used).

Can anyone tell me what parameter to use to query the file description or whether there's a bug and where to find the complete mapping?


Thanks in advance & best regards,

p0lDi

In addition I noticed that the backend field "Keyword" is actually stored in column "f_shortinfo" instead of "f_keywords", as I would have expected. Also a bug?

User avatar
flip-flop
Moderator
Posts: 8178
Joined: Sat 21. May 2005, 21:25
Location: HAMM (Germany)
Contact:

Re: Adjusting filelist template

Post by flip-flop » Wed 1. Apr 2009, 18:47

Hi,

using the cp file list all entries from the cp available in the example default template:
/template/inc_default/filelist.tmpl

Code: Select all

<!--FILE_SETTINGS_START//-->
; this is formatted like WIN.INI
; please: do not use comments for value lines
icon_path 			= "img/icons/"
icon_name 			= "small_icon_{FILE_EXT}.gif"
thumbnail			= 1
thumbnail_width		= 50
thumbnail_height	= 50
thumbnail_crop		= 1
file_size_round		= 1
file_size_space		= " "
date_format			= "%m/%d/%y"
set_locale			= "de_DE@Euro"
<!--FILE_SETTINGS_END//-->
[TITLE]<h4>{TITLE}</h4>[/TITLE]
[SUBTITLE]<h5>{SUBTITLE}</h5>[/SUBTITLE]
[TEXT]{TEXT}[/TEXT]
<div style="margin-top: 15px; padding-top: 10px; border-top: 1px dotted #CCCCCC;">
<!--FILE_ENTRY_START//-->
	<div class="fileEntry" style="margin-bottom:10px; padding-bottom: 10px; border-bottom: 1px dotted #CCCCCC;">
		<h2>
			[FILE_IMAGE_ELSE]<img src="{FILE_ICON}" alt="" border="0" />[/FILE_IMAGE_ELSE]
			[FILE_IMAGE]<img src="{FILE_IMAGE}" alt="" border="" />[/FILE_IMAGE]
			<a href="{FILE_LINK}&target=0"{FILE_TARGET}>[FILE_TITLE]{FILE_TITLE}[/FILE_TITLE][FILE_TITLE_ELSE]{FILE_NAME}[/FILE_TITLE_ELSE]</a>
		</h2>
		<p>[FILE_DESCRIPTION]
		{FILE_DESCRIPTION}<br />[/FILE_DESCRIPTION]
		{FILE_EXT}, {FILE_SIZE}, {FILE_DATE}, {FILE_DOWNLOADS} downloads
		</p>

	</div>

<!--FILE_ENTRY_END//-->
</div> 
But I think you mean a combination of the cp file list and filecenter data.


A fast hint:

In the template:

Code: Select all

<!--FILE_ENTRY_START//-->

[PHP]
	foreach($GLOBALS['content']['files_result'] as $_files_x => $value) {
		$_longinfo =  $value['f_name'] == '{FILE_NAME}' ? $value['f_longinfo'] : '';
		echo $_longinfo;
	}

//	dumpVar($GLOBALS['content']['files_result']);
[/PHP]

Make a test with

Code: Select all

dumpVar($GLOBALS['content']['files_result']);
and you will see ....

Knut
>> HowTo | DOCU | FAQ | TEMPLATES/DOCS << ( SITE )

p0ldi
Posts: 3
Joined: Wed 1. Apr 2009, 15:00

Re: Adjusting filelist template

Post by p0ldi » Thu 2. Apr 2009, 11:28

Hi Knut,

Thank you for your quick response, unfortunately I still don't get it. By now I understood that the global [FILE_DESCRIPTION] refers to the file list and not the individual files, so that one actually works. The code [FILE_TITLE]{FILE_TITLE}[/FILE_TITLE] though returns nothing, even though I have entered a description for all my files.

In order to find out what options I have, I copied the code you mentioned to the template you refered to (even though I assume it's not loaded anywhere but rather a backup?) and as well to the one I created and have selected in the file list on the backend: \phpwcms\template\inc_cntpart\filelist\own_template.html

All I get then is a page with the complete code, so basically the code is regarded as text and simpley echoed. I assume when putting code into [PHP] ... [/PHP] it is somehow not parsed. Is there something I need to set up first?


Thanks & Best regards,

p0lDi

P.S.: When you write "cp" do you mean content part?

User avatar
flip-flop
Moderator
Posts: 8178
Joined: Sat 21. May 2005, 21:25
Location: HAMM (Germany)
Contact:

Re: Adjusting filelist template

Post by flip-flop » Thu 2. Apr 2009, 11:35

cp = contentpart

Please switch in your config:

Code: Select all

$phpwcms['allow_cntPHP_rt']   = 1;
Then the snippet will run.

Knut
>> HowTo | DOCU | FAQ | TEMPLATES/DOCS << ( SITE )

User avatar
update
Moderator
Posts: 6386
Joined: Mon 10. Jan 2005, 17:29
Location: germany / outdoor

Re: Adjusting filelist template

Post by update » Thu 2. Apr 2009, 11:38

p0ldi wrote:Is there something I need to set up first?
Probably yes....
have a look into your conf file: are these set to 1?
$phpwcms['allow_cntPHP_rt'] = 1;

:oops: too late...
It's mostly all about webdesign, logo design, new and old pages refresh, print BUT slowly switching to be supporter for the band Mykket Morton. Visit Mykket Morton on FB. Listen Mykket Morton and live videos on youtube.

p0ldi
Posts: 3
Joined: Wed 1. Apr 2009, 15:00

Re: Adjusting filelist template

Post by p0ldi » Thu 2. Apr 2009, 12:14

Awesome, thanks flip-flop & claus!

In case somebody ever wants to do the same, please find the final contents of my template (stored in \template\inc_cntpart\filelist) below:

Code: Select all

	<div class="fileEntry">
		[FILE_IMAGE_ELSE]<img src="{FILE_ICON}" alt="" border="0" />[/FILE_IMAGE_ELSE]
		[FILE_IMAGE]<img src="{FILE_IMAGE}" alt="" border="" />[/FILE_IMAGE]
		<a href="phpwcms/{FILE_LINK}"{FILE_TARGET}>
		[PHP]
		   foreach($GLOBALS['content']['files_result'] as $_files_x => $value) {
		      $_longinfo =  $value['f_name'] == '{FILE_NAME}' ? $value['f_longinfo'] : '';
		      echo $_longinfo;
		   }

		   //dumpVar($GLOBALS['content']['files_result']);
		[/PHP]		
		</a>
	</div>
This will basically return all files with a small icon and the longinfo as link text.


Regards,

p0lDi

Post Reply