PDF Link in structured data field is not resoveld

Hi,

I stored a link syntax in structured field: (file: tkpl.pdf text: The Kitchen People Ltd Terms and Conditions) But it is not displayed properly. Only the text is displayed, but it is not displayed as a hyperlink. If I put the link syntax in the Content Field of the page, it works fine.

Any Ideas?

Best, Christian

Could you please post the content text file of the page and the template code you use to display the content?

Of course :smile:

Content Files:
https://dl.dropboxusercontent.com/u/2681197/_transfer/content--article.en.txt.zip

Template:
I have a atomic template/snippet structure.

Organism :

$additional_columns = yaml($data->columns());
$additional_columns = reset($additional_columns);

if(isset($additional_columns["text2"]) && preg_match("=[a-zA-Z]=", $additional_columns["text2"])){
	atomicdesign::output("molecule", "textblock", array(
		"excerpt"=> $additional_columns["text2"],
		"content"=> $data,
		"heading"=>"no-headline",
		"layout_classes"=> $layout_classes,
		"behavior_classes"=> $behavior_classes,
		"docs"=> $docs
	));
}

if(isset($additional_columns["text3"]) && preg_match("=[a-zA-Z]=", $additional_columns["text3"])){
	atomicdesign::output("molecule", "textblock", array(
		"excerpt" => $additional_columns["text3"],
		"content" => $data,
		"heading"	=> "no-headline",
		"layout_classes"=> $layout_classes,
		"behavior_classes"=> $behavior_classes,
		"docs"=> $docs
	));
}

Molecule

	if(isset($excerpt) && $excerpt != ""){
		atomicdesign::output("atom","text", array("text" => $excerpt));	
		
	}else if($content->text() != ""){
		atomicdesign::output("atom","text", array("text" => $content->text()));	
	}

##Atom
<?php echo kirbytext($text); ?>

The Dropbox link currently 404s. But one file would be enough anyway. :smile:

Hm. The DB links works for me. Please try again. Otherwise: http://christiannoss.de/playground/content--article.en.txt

Alright, thanks.

Your code structure is quite complex. While it is modular, it makes it hard to debug such issues, also given that I don’t know:

  • how your atomicdesign class works internally,
  • how the organism is called from the template and
  • what $data refers to.

Could you please try reducing your test case to a simple template?

Hi, sry i was one day off:) Here is the code:

foreach($pages->children()->visible() as $containter){
	
	/* Zusätzliche Textspalten */
	$additional_columns = yaml($containter->columns());
	$additional_columns = reset($additional_columns);

	echo kirbytext($additional_columns["text3"]);
	
}

Have you checked if it works in a standard text field?

The file tag returns just the text if the file does not exist.

:blush: yes! thank you

sorry, it’s me again. It works not via strucured data filed if I use the following syntax:
(file: tkpl.pdf text: Supertext)

And it works if I use:
(link: tkpl.pdf text: Supertext)

But the last syntax does not refer to the proper file url.

The (file) Syntax works fine in standard text field. Why is the (file) in structured data field treated different?

Any suggestions?

Best, c

Have you tried with the Kirby 2.2? Or using the toStructure() method instead of yaml()?

I just checked on 2.2 with the toStructure method and everything works as expected here.

Hmmm… i do not get it work, either with 2.2 nor with to Structure ;( My code is:

foreach($containter->columns()->toStructure() as $column){
	echo $column->kirbytext() ."<hr>";
}

What is the name of the field that contains the link to the pdf, somehow this is missing here.

I guess, $containter is the page, columns the name of the structure field. But the name of the field within the structure field is missing from this line:

echo $column->kirbytext() ."<hr>";

it should be sth like

echo $column->nameOfField()->kirbytext() ."<hr>";

yes! awesome. Thanks!