Keyword

Read More in New Tab? [Breaks my Site]

  • Roger Edrinn
  • Roger Edrinn's Avatar Topic Author
  • Offline
  • Senior Member
More
14 years 2 months ago #93638 by Roger Edrinn
Read More in New Tab? [Breaks my Site] was created by Roger Edrinn
When my user clicks "Read More" in the front end, I'd like the K2 Item to open in a new tab and not over the Category View. Is there a switch in K2 Parameters to accomplish Read More in a new Tab?

 

Thanks

Please Log in or Create an account to join the conversation.

More
14 years 2 months ago #93639 by Terry Britton
Replied by Terry Britton on topic Read More in New Tab? [Breaks my Site]
Unfortunately there is nothing in html that supports openining a new tab. You can use _blank to open a new window and if the user has configured there browser (not all browsers are configurable in this way) to open new windows in a tab it will work as you want. If not it will open a new window. In any case change line 267 in category_item.php as follows.

<a class="k2ReadMore" target="blank" href="<?php echo $this->item->link; ?>">

Please Log in or Create an account to join the conversation.

  • Roger Edrinn
  • Roger Edrinn's Avatar Topic Author
  • Offline
  • Senior Member
More
14 years 2 months ago #93640 by Roger Edrinn
Replied by Roger Edrinn on topic Read More in New Tab? [Breaks my Site]
Terry,

Great tip, but I've been FTPing all over my site, just what folder holds category_item.php?

Thanks

Terry A Britton said:

Unfortunately there is nothing in html that supports openining a new tab. You can use _blank to open a new window and if the user has configured there browser (not all browsers are configurable in this way) to open new windows in a tab it will work as you want. If not it will open a new window. In any case change line 267 in category_item.php as follows.

<a class="k2ReadMore" target="blank" href="<?php echo $this->item->link; ?>">

Please Log in or Create an account to join the conversation.

  • Roger Edrinn
  • Roger Edrinn's Avatar Topic Author
  • Offline
  • Senior Member
More
14 years 2 months ago #93641 by Roger Edrinn
Replied by Roger Edrinn on topic Read More in New Tab? [Breaks my Site]
Found it, wish there was a search for files.

I changed this:

<?php if ($this->item->params->get('catItemReadMore')): ?>

To this:

<a class="k2ReadMore" target="blank" href="<?php echo $this->item->link; ?>">

At line 267

I'll let you know.

 

Terry A Britton said:

Unfortunately there is nothing in html that supports openining a new tab. You can use _blank to open a new window and if the user has configured there browser (not all browsers are configurable in this way) to open new windows in a tab it will work as you want. If not it will open a new window. In any case change line 267 in category_item.php as follows.

<a class="k2ReadMore" target="blank" href="<?php echo $this->item->link; ?>">

Please Log in or Create an account to join the conversation.

  • Roger Edrinn
  • Roger Edrinn's Avatar Topic Author
  • Offline
  • Senior Member
More
14 years 2 months ago #93642 by Roger Edrinn
Replied by Roger Edrinn on topic Read More in New Tab? [Breaks my Site]
I got this error:

Parse error: syntax error, unexpected T_ENDIF in /home/edrinn/public_html/components/com_k2/templates/default/category_item.php on line 274


Time to load my backup file.

 



 

Please Log in or Create an account to join the conversation.

  • Roger Edrinn
  • Roger Edrinn's Avatar Topic Author
  • Offline
  • Senior Member
More
14 years 2 months ago #93643 by Roger Edrinn
Replied by Roger Edrinn on topic Read More in New Tab? [Breaks my Site]
Using the infinite monkey model . . .

On line 270 I found this:

<a class="k2ReadMore" href="<?php echo preg_replace("/Itemid=(\d+)/","Itemid=".$_GET,$this->item->link); ?>">

which I replaced with your code. Lo and behold . . . Read More now opens in a new tab!!!

I'll leave it to your wisdom to decipher the 267 vs 270.

You must do this for a living to know all this.

 

Thanks for your help. :)

 

BTW: /public_html/components/com_k2/templates/default/category_item.php

Please Log in or Create an account to join the conversation.

More
14 years 2 months ago #93644 by Terry Britton
Replied by Terry Britton on topic Read More in New Tab? [Breaks my Site]
You're right, sorry I got you off on the wrong line.

Please Log in or Create an account to join the conversation.

More
14 years 2 months ago #93645 by Simon Wells
Replied by Simon Wells on topic Read More in New Tab? [Breaks my Site]
Hi Roger,

I recommend not to modify the core files, if you update K2, you loose your changes.Consider creating a template over ride, essentially a copy of the default template, but placed within yourjoomlatemplate/html/com_k2

 

Terry, simple but effective

Simon
Roger Edrinn said:

Using the infinite monkey model . . .

On line 270 I found this:

<a class="k2ReadMore" href="<?php echo preg_replace("/Itemid=(\d+)/","Itemid=".$_GET,$this->item->link); ?>">

which I replaced with your code. Lo and behold . . . Read More now opens in a new tab!!!

I'll leave it to your wisdom to decipher the 267 vs 270.

You must do this for a living to know all this.

 

Thanks for your help. :)

 

BTW: /public_html/components/com_k2/templates/default/category_item.php

Please Log in or Create an account to join the conversation.

  • Roger Edrinn
  • Roger Edrinn's Avatar Topic Author
  • Offline
  • Senior Member
More
14 years 2 months ago #93646 by Roger Edrinn
Replied by Roger Edrinn on topic Read More in New Tab? [Breaks my Site]
Over my head. You'll need to give me more details.

Simon Wells (K2 Support) said:
Hi Roger,

I recommend not to modify the core files, if you update K2, you loose your changes.Consider creating a template over ride, essentially a copy of the default template, but placed within yourjoomlatemplate/html/com_k2

 

Terry, simple but effective

Simon Roger Edrinn said:

Using the infinite monkey model . . .

On line 270 I found this:

<a class="k2ReadMore" href="<?php echo preg_replace("/Itemid=(\d+)/","Itemid=".$_GET,$this->item->link); ?>">

which I replaced with your code. Lo and behold . . . Read More now opens in a new tab!!!

I'll leave it to your wisdom to decipher the 267 vs 270.

You must do this for a living to know all this.

 

Thanks for your help. :)

 

BTW: /public_html/components/com_k2/templates/default/category_item.php

Please Log in or Create an account to join the conversation.

More
14 years 2 months ago #93647 by william white
Replied by william white on topic Read More in New Tab? [Breaks my Site]
Templating

Please Log in or Create an account to join the conversation.

  • Roger Edrinn
  • Roger Edrinn's Avatar Topic Author
  • Offline
  • Senior Member
More
14 years 2 months ago #93648 by Roger Edrinn
Replied by Roger Edrinn on topic Read More in New Tab? [Breaks my Site]
Turns out that one simple line of code at line 270 Breaks my Website. Here's how:

I have a dynamic variable (written by a freelancer) that allows the insertion of the menu link name into the Item text, that same variable can also be used to call unique images into the displayed Item at Read More.

Here's an example:

By example:Five Menu Links:1) Rye2) Wheat3) Matza4) Pumpernickel3) WhiteTypical Item text in the admin side:

My bread taste good, especially my [Bread] bread.

 

Clicking the menu link Matza would yield this, both in the category view and the Read more view:

My bread taste good, especially my Matza bread.

 

With the line 270 substitution, the category view reads Matza, but the Read more view reads "White" and the White images are called, not Matza.

 

Who'd Thunk?

 

So no Read more in a new tab. :(

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum