Judah Raine
Total posts: 332
25 Нояб 2012 01:35

I have spent an entire day sifting through templates and still cannot find the dratted "> that appears as follows:

I have identified it (I think) on Firebug as being part of the url field:

I am trying to achieve this:

You copy and edit fields templates and ensure that field image return only image and field URL only URL withut HTML. Then in template

fields_by_id[10]->result, $item->fields_by_id[12]->result);?>

where 10 is ID of the URL field and 12 is and ID of the image field.

I am using the gallery field and not the image field, and am still trying to work out how to get the url to output only url without html, but have now been sidetracked with the dratted ">!!

I have thus far only copied the default url output file and called it headerbanner.php, but not changed anything at all.

I am using an input template which I have used for a few other things and which has not brought this "> into anything else, so my assumption is that it's not the input field that's the problem.

That really only leaves the article template, which I've attached. If anyone can spot this - and you probably will first time off - I would be very grateful. I now feel like a complete and utter idiot, and have avoided asking this question... Yes, I'm a dork, so sorry. (But a desperate dork)

Another method is to parse string in article/article list template.

Последние изменения: 02 Март 2014


Judah Raine
Total posts: 332
04 Дек 2012 10:03

The fields definitely display correctly if set up to display individually. I will try the above and let you know the result.


Judah Raine
Total posts: 332
04 Дек 2012 10:11

I have deleted everything after the return, but the link still reads:

http://www.classicromancerevival.com/index.php?option=com_cobalt& ;view=record&id=30:judah-raine&Itemid=658

Currently the bannerheader file contains only:

<?php

$value = $this->value; 

echo 'http://' . $value[0]['url']; 

return; ?>

and absolutely nothing else. I really feel like a complete idiot here.


Sergey
Total posts: 13,748
04 Дек 2012 20:23

You see this part

?>

<?php

This means that it prints new line before url.

What i need you to do is to place this in your template and show me what was the result

echo 'start-----
';

echo htmlspecialchars($item->fields_by_id[50]->result);

echo '
-----
';

echo htmlspecialchars($item->fields_by_id[51]->result);

echo '
end-----';


Judah Raine
Total posts: 332
04 Дек 2012 22:20

This is what displays:

start-----


http://judahraine.com

end-----


Judah Raine
Total posts: 332
05 Дек 2012 23:31

This may have something to do with it... on going through list.php once again for the gallery field, I have ascertained that it does not in fact contain this:

$html_img = JHTML::image($url, @$value['image_title'], array('hspace' => $this->params->get('params.img_hspace'), 'vspace' => $this->params->get('params.img_vspace'), 'title' => @$value['image_title']));

which is what you asked me to replace. I did not notice it at the time, but the actual code is different - there are two options that could need to be replaced but I will add the code as it appears in the file:

$url = sprintf('%s/thumbs_cache/%s/%s', $this->url, $date, $new_name);

$key = md5($file['filename'] . 'full' . $full_width . $full_height . $full_quality . $full_stretch);

$new_name_full = $key . '.' . $file['ext'];

$img_full = $this->path . $date . DS . $new_name_full;

if (!JFile::exists($img_full))

{

    $this->resizer->stretch_if_smaller = $full_stretch;

    $this->resizer->quality = $full_quality;

    $this->resizer->setImage(JComponentHelper::getParams('com_cobalt')->get('general_upload') . DS . $subfolder . DS . $date . DS . $file['filename']);

    $this->resizer->resize_limitwh($full_width, $full_height, $img_full);

}



$url_to_original = sprintf('%s/thumbs_cache/%s/%s', $this->url, $date, $new_name_full);

if ($this->params->get('params.count_views'))

{

    $url_to_original = sprintf('%sindex.php?option=com_cobalt&task=files.show&id=%d&file_key=%s&no_html=1', JURI::root(), $file['id'], $key);

}

if ($this->params->get('params.quickbox_click', 0) == 1)

{

    $url_to_original = JURI::root() . $this->record->url;

}



$i ++;

if ($this->params->get('params.show_mode', 'gallerybox') != 'gallerybox' && $i > 3)

{

    if ($this->params->get('params.quickbox_click', 0) == 1)

    {

        break;

    }

    $out2[] = sprintf($patern_img, $url, $index, ($file['title'] ? $file['title'] : $file['realname']), $url_to_original, $url);

}

else

{

    $out[] = sprintf($patern_img, $url, $index, ($file['title'] ? $file['title'] : $file['realname']), $url_to_original, $url);

}

}

$class = $this->params->get('core.field_class', false);

?>

This may well be what is creating the problem?


Sergey
Total posts: 13,748
05 Дек 2012 23:45

Yes. Change this

$i ++; 

if ($this->params->get('params.show_mode', 'gallerybox') != 'gallerybox' && $i > 3) 

{ 

if ($this->params->get('params.quickbox_click', 0) == 1) 

{ 

break; 

} 

$out2[] = sprintf($patern_img, $url, $index, ($file['title'] ? $file['title'] : $file['realname']), $url_to_original, $url); 

} 

else 

{ 

$out[] = sprintf($patern_img, $url, $index, ($file['title'] ? $file['title'] : $file['realname']), $url_to_original, $url); 

} 

to

echo '<img src="'.$url.'">';

Sergey
Total posts: 13,748
05 Дек 2012 23:47

ANd place return after that line. Because you do not need anything else blow this line.


Judah Raine
Total posts: 332
06 Дек 2012 02:08

If I replace the above with this:

?php echo ''; return; ?>

I get this error message:

Parse error: syntax error, unexpected '<' in /home/classicr/public_html/components/com_cobalt/fields/gallery/tmpl/output/bannerlist.php on line 123

If I replace it with:

echo ''; return;

I get this error message:

Parse error: syntax error, unexpected $end in /home/classicr/public_html/components/com_cobalt/fields/gallery/tmpl/output/bannerlist.php on line 124

If I replace it with this:

{

echo ''; return;

}

I get the following error:

Parse error: syntax error, unexpected $end in /home/classicr/public_html/components/com_cobalt/fields/gallery/tmpl/output/bannerlist.php on line 124

If I try this:

{

?php echo ''; return; ?>

}

I get this error message:

Parse error: syntax error, unexpected '<' in /home/classicr/public_html/components/com_cobalt/fields/gallery/tmpl/output/bannerlist.php on line 123

Guess I'm more ignorant than ever:D


Sergey
Total posts: 13,748
06 Дек 2012 03:36

Attach all file.


Judah Raine
Total posts: 332
06 Дек 2012 04:05

Files attached, thank you


Sergey
Total posts: 13,748
06 Дек 2012 06:42

bannerlist-galler

You are already in <?php you do not need to open it again

last lines should be

    if ($this->params->get('params.quickbox_click', 0) == 1)

    {

        $url_to_original = JURI::root() . $this->record->url;

    }

    echo '<img src="'.$url.'">'; 

    return;

}

Judah Raine
Total posts: 332
06 Дек 2012 23:18

Than you :D


Judah Raine
Total posts: 332
06 Дек 2012 23:32

This worked like a dream... just one more teeny question :D

If I wanted it to open in a new window, would I add something like this:

$options = $this->params->get('params.open_url', 1) ? ' target="_blank"' : '';


Sergey
Total posts: 13,748
07 Дек 2012 01:04

Looks correct.


Judah Raine
Total posts: 332
07 Дек 2012 22:33

So far so good... would I add this in the url output or the gallery output? Also, I would have to also add in &options somewhere, wouldn't I?


Judah Raine
Total posts: 332
07 Дек 2012 22:56

or rather $options...


Sergey
Total posts: 13,748
08 Дек 2012 20:36
fields_by_id[51]->result, $item->fields_by_id[50]->result, array('target' => '_blank'));?>

Judah Raine
Total posts: 332
08 Дек 2012 22:17

Ah, the template file... :D Thank you so much


Judah Raine
Total posts: 332
08 Дек 2012 23:18

This worked very well thank you. But I am now having an issue with displaying this in the spiral scripts featured article module. Their template uses the following to display fields (they work with fields not article itself)

fields['Banner Upload'])): ?> fields['Banner Upload']; ?>

The problem is, of course, that the link is set in our article template and not in the field template. If I use the above I get the two fields displayed separately.

I did try using fields['Banner Upload'])): ?> followed by the code you have supplied above, but this generated errors. I would be very grateful if you could assist here - spiral scripts takes forever to respond and then usually with nothing useful at all...

Работает на Cobalt