Can I change the overlay info?

News Show Pro GK5 - flexible, responsive and easily extendable free Joomla module support forum.
Rate this topic: Evaluations: 1, 6.00 on the average.Evaluations: 1, 6.00 on the average.Evaluations: 1, 6.00 on the average.Evaluations: 1, 6.00 on the average.Evaluations: 1, 6.00 on the average.Evaluations: 1, 6.00 on the average.6.00 out of 6 based on 1 vote(s)
GK User
Tue Mar 10, 2015 11:29 pm
Hello.

I'm using the template "John", but my question is about NSP overlay image.

When you click the image in Porfolio II mode, it displays the image at rhe right hand, and Author, Date and Category at the right side.

Can I change that info (Author, Date, Cat) fot other kind of content? Like a description, or custom HTML?

Thanks in advance.
User avatar
Fresh Boarder

GK User
Wed Mar 11, 2015 7:15 am
You would like to change labels?
User avatar
Moderator

GK User
Fri Mar 13, 2015 1:15 am
No. It would be rather like custom HTML content. My client needs a product image on the left, and a brief description and table on the right side.

Something like this
User avatar
Fresh Boarder

GK User
Mon Mar 16, 2015 8:56 am
Sorry, but this is beyond our technical support.
It can be done with editing od js/php files but if you don know how to do it I would suggest to hire one of Gavick mods to do this custom work.
User avatar
Moderator

GK User
Mon Mar 16, 2015 8:04 pm
Oh, ok. So here comes the other part of the question. It doesn't matter if the whole thing is an image.

I actually know how to manage the script.query.js or just the CSS in fact, in order to eliminate the info at the right hand, and to put only the image, including the description in a single JPG, that wouldn't be a problem.

The issue with this is that the thumbnail link wouldn't look good like that, and I just need to use a different thumbnail from the overlay image. Is that possible?

Here, this is where I'm developing that.

Regards
User avatar
Fresh Boarder

GK User
Wed Mar 18, 2015 1:54 pm
You mean putting "tabularic" data into image itself as you did and separating thumbnail from big image?
This is how this module works and it cannot be changed without module redesign :(.
User avatar
Moderator

GK User
Wed Mar 18, 2015 4:35 pm
What a pity :(

I tried changing the cache thumbnail, but as it refreshes a time later it will put again the original thumbnail. I don't know, if may be I disable the cache or something.

Well, thanks anyway.
User avatar
Fresh Boarder

GK User
Fri Mar 20, 2015 7:10 pm
Disabling cache is not the best idea. I would dig more into changing currently made implementation to support reading content of k2 article and displaying it in popup. One thing is to get it out in module itself (php), second is to display it via jQuery.
User avatar
Moderator

GK User
Fri Mar 20, 2015 7:19 pm
Yeah, ok, I'll figure something out. Thanks mate!
User avatar
Fresh Boarder

GK User
Sun Mar 22, 2015 11:26 am
If you get stuck somewhere please let me know - we don't support this kind of changes, but I can point you into right direction if you get stuck.
User avatar
Moderator

GK User
Thu Mar 26, 2015 2:02 am
Ok mate, I think I got it somehow. It's not a fancy tweak at all, but it serves the purpose I need. Please tell me if I have to change something or if may be there is some kind of security issue or something.

You can check it out here

First of all I just created an override folder inside my template (in this case John S.), so the folder looks like:

Code: Select all
templates/gk_john_s/html/mod_news_pro_gk5/portal_modes/portfolio2

and inside I put these two files:
Code: Select all
controller.php
script.jquery.js


What I figured out was no to create a new var for the intro text (I didn't how to do that or where) so instead I thought about replacing the author variable definition with the article text according to model.php

So, I only changed 3 lines in those 2 files.

controller.php
Line 69
Erase everything except for data-author, data-author-text and data-img, and replace content[$i]['author_username'] with content[$i]['text'], so it looks like this:
Code: Select all
echo   'data-author="'.$this->parent->content[$i]['text'].'"
      data-author-text="'.JText::_('MOD_NEWS_PRO_GK5_PORTAL_MODE_PORTFOLIO2_AUTHOR_TEXT').'"
      data-img="'.strip_tags($this->get_image($i)).'"';



script.jquery.js
Line 36
Erase the html tags for date and category and leave only the author tag (now the text)

Line 122
Erase the "Author" title above the author name, so now the "author" var it displays only the intro text.
User avatar
Fresh Boarder

GK User
Thu Mar 26, 2015 2:09 am
BTW I'm using Joomla Categories for data source instead of K2.
User avatar
Fresh Boarder

GK User
Fri Mar 27, 2015 7:46 am
No console logs regarding this change, works like a charm, great work.
User avatar
Moderator

GK User
Fri Mar 27, 2015 7:54 pm
Awesome! Thanks. This can be tagged as solved then.

Regards.
User avatar
Fresh Boarder

GK User
Sun Mar 29, 2015 2:18 pm
Please let me know if you would have any additional questions regarding this topic.
User avatar
Moderator

GK User
Sun Apr 05, 2015 12:49 pm
This is awesome! I would like to show the K2-article-text. But I have no idea what string I have to use to echo the k2-text.

Code: Select all
'data-cat-text="'.JText::_('MOD_NEWS_PRO_GK5_PORTAL_MODE_PORTFOLIO2_CAT_TEXT').'"
                     data-author="'.$this->parent->content[$i]['author_username'].'"
                     data-author-text="'.JText::_('MOD_NEWS_PRO_GK5_PORTAL_MODE_PORTFOLIO2_AUTHOR_TEXT').'"
                     data-img="'.strip_tags($this->get_image($i)).'"';


this gives me the Category and the author. How to add the K2-text?

Thanks in advance!
User avatar
Junior Boarder

GK User
Mon Apr 06, 2015 11:02 am
Code: Select all
$this->parent->content[$i]['text'

should give you article content.
User avatar
Moderator

GK User
Tue Apr 07, 2015 3:17 pm
The output of the text works! But as soon as there is any character in it which looks like jave (" > and so on...) the hole module gets scrambled.

So if there is an " or brackets in the text (like when adding an image) the module gets broken and puts out java-strings instead of the text.
Is there a command that prevents that? So that the string isn't converted into Java?

Thanks
User avatar
Junior Boarder

GK User
Wed Apr 08, 2015 7:49 am
Actually you are outputting into html source code and yes - any ' or " or anything like that will mess with javascript that is used to generate final view. I'm afraid there is no way to easy fix that.
User avatar
Moderator

GK User
Sun Apr 12, 2015 2:46 pm
thanks for the info! I feared that this wouldn't be possible to solve in an easy way.
I will try another solution. If it works out, I'll post my solution in this thread.
User avatar
Junior Boarder

GK User
Mon Apr 13, 2015 3:17 pm
What comes to my mind is to escape quotes and single quotes:
http://stackoverflow.com/questions/1613 ... javascript
You would need to parse each element with php and replace each single and double quote with escaped one... And it actully might work.
User avatar
Moderator

GK User
Fri Apr 17, 2015 9:27 pm
Actually yes, you are absolutely right sir.

I didn't try with classes inside the content text tags I put there at the beginning. But as soon as I put some ids and classes the html code just showed all messed up in the front page, same as CYBEREK above.

But I replaced all the " with ' and vice versa in a little block of the code, only had to do it in the controller.php line where this variable was defined:

Code: Select all
               echo   "
                     data-author='".$this->parent->content[$i]["text"]."'
                     data-author-text='".JText::_("MOD_NEWS_PRO_GK5_PORTAL_MODE_PORTFOLIO2_AUTHOR_TEXT")."'
                     data-img='".strip_tags($this->get_image($i))."'
                     ";


(In my file is around line 69).

That did the trick.
User avatar
Fresh Boarder

GK User
Sun Apr 19, 2015 2:01 pm
Could you paste the code after the change? It might be useful for other users as well.
User avatar
Moderator

GK User
Sun Apr 19, 2015 7:14 pm
Yes, it's the code I pasted in my last post. But I'll put it here again:

controller.php - around line 68
Code: Select all
               echo   "
                     data-author='".$this->parent->content[$i]["text"]."'
                     data-author-text='".JText::_("MOD_NEWS_PRO_GK5_PORTAL_MODE_PORTFOLIO2_AUTHOR_TEXT")."'
                     data-img='".strip_tags($this->get_image($i))."'
                     ";
User avatar
Fresh Boarder

GK User
Mon Apr 20, 2015 6:28 am
So basically you didn't use php to replace ' with " (or " with '), but simply edited the original article and made the change there?
User avatar
Moderator

GK User
Mon Apr 20, 2015 7:40 am
No, I did edited the controller.php file, not the joomla article itself.

Just replaced every quote " for single quote ' and vice versa, but only in that little block of code I pasted before. I tested the resultos only changing it in that line and that was enough.

You can chek the result here, in the first image.
User avatar
Fresh Boarder

GK User
Mon Apr 20, 2015 4:59 pm
Actually something like that:
Code: Select all
data-author='".str_replace("'",'"',$this->parent->content[$i]["text"]);."'

What it does - it replaces each single quote with double quote - and should be enough to make the text work correctly whatever you enter into an article.
User avatar
Moderator

GK User
Mon Apr 20, 2015 6:22 pm
Indeed, yes. I mean, I suppose you suggest to do that in order to avoid any changes to the use of " and ' in general.

So yes, I reverted the quotes again to its original coding use, and implemented that string replace and it works like a charm. So again I'll post here those lines 69-73 in the file controller.php

Note about your suggestion:
- I took away the closing semicolon you put in the data-author you suggested, for that wasn't the last line of code there.
- I reverted the " and ' you pasted because the original string quote in controller.php is the single quote.


Code: Select all
            echo   '
                  data-author="'.str_replace('"',"'",$this->parent->content[$i]["text"]).'"
                  data-author-text="'.JText::_("MOD_NEWS_PRO_GK5_PORTAL_MODE_PORTFOLIO2_AUTHOR_TEXT").'"
                  data-img="'.strip_tags($this->get_image($i)).'"
                  ';




Regards
User avatar
Fresh Boarder

GK User
Wed Apr 22, 2015 6:28 pm
Thanks for verifying and pasting final working solution.
Is there anything else I can help you with regarding this topic?
User avatar
Moderator


cron