By Mist on Tuesday, 24 June 2014
Posted in General Issues
Replies 7
Likes 0
Views 1.2K
Votes 0
Hi guys, i am in "pain" for so long now trying to make this module (mod_recentdiscussions) retrieve the informations i want for easydiscuss posts.

I know that the module was built from the ground up to just retrieve basic post information.
I am trying to use the some code that works perfect inside frontpage.post.php template file for EasyDiscuss.
So this code work flawless there, but not inside the mod_recentdiscussions module template file (default.php)

If you guys think that you can help with anything .... it would save me from headache. If you think that this is a custom mod ... then i am out of luck and i should figure something else out.

So, what i am trying to achieve is make the mod_recentdiscussions module display the posts similar like they show up in our frontpage.post.php file.

Long story short, i would need the code below to work in the module template file.

1 Retrieve the post attachments and display the first one.

<?php
$attachments = $post->getAttachments();
$attachment = isset( $attachments[ 0 ] ) ? $attachments[ 0 ] : false;
?>

<?php if ( $attachment ) {?>
<img src="<?php echo $this->baseurl ?>/assets/image/green.jpg" data-toggle="unveil" class="unveiled">
<?php } else { ?>
***show_this***
<?php } ?>


2. Check if there is a post reply, if yes show the reply information, if not, show something else

<?php if( isset( $post->reply ) ){ ?>
<?php if( $post->reply->id ){ ?>
<li>
<div class="img-group img-group-stack">
<img alt="" class="img-circle" src="<?php echo $post->reply->getAvatar();?>" data-es-provide="tooltip" data-placement="top" data-original-title="<?php echo $this->escape( $post->reply->getName() );?>">
</div>
</li>
<li class="text-right">
<?php $lastReply = DiscussHelper::getModel( 'Posts' )->getLastReply( $post->id ); ?>
<p class="nm"><a class="semibold" href="<?php echo DiscussRouter::getPostRoute( $post->id ) . '#' . JText::_('COM_EASYDISCUSS_REPLY_PERMALINK') . '-' . $lastReply->id;?>"> Reply</a> <?php echo $post->duration; ?> <time datetime="<?php echo $this->formatDate( '%Y-%m-%d' , $post->created ); ?>"></time></p>
</li>

<?php } ?>
<?php } else { ?>
<li>
<div class="img-group img-group-stack">
<img alt="" class="img-circle" src="/templates/my_template/html/com_easysocial/avatars/users/medium.png">
</div>
</li>
<li class="text-right">
<p class="nm">No Reply</p>
</li>
<?php } ?>



So, all of the code above works perfect inside frontpage.post.php template file within EasyDiscuss .. but does not work within default.php template file of mod_recentdiscussions module.

Thanks in advance !
Sorry I can't help you troubleshoot, but if you have a link or image do you mind sharing with us? Interested to see how it looks like with your edits.
Kai
·
Tuesday, 24 June 2014 11:10
·
0 Likes
·
0 Votes
·
0 Comments
·
It's a really big overall change. It doesn't look like a forum or like the default easydiscuss layout. We focused to build a layout based on Boostrap 3 grid system where the grid items (hence easydiscuss "posts") will look great.
I can't post a screenshot because it's still under heavy development but i can attach an example, it's pretty much similar.

You wouldn't say that our website is built with EasyDiscuss, EasyBlog, EasySocial and Joomla . Pretty much everything is customized.

Take a look at the attachment below. EasyDiscuss pretty much look like that on our website. (it's just an example but we are inches close to it )
·
Tuesday, 24 June 2014 17:27
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Mist,

May I know what's the error you are facing while implement this in the module default.php? or you can provide us your custom default.php so we can troubleshoot it for you.
·
Tuesday, 24 June 2014 19:39
·
0 Likes
·
0 Votes
·
0 Comments
·
Thanks for replying Nik !

I think that not all variables are working inside modules. The EasyDiscuss modules helper files or the way they are built does not allow to use the entire post informations from EasyDiscuss. They are stripped down to minimum.

My utlimate goal is to "replicate" the "view" of the EasyDiscuss item (frontpage.post.php template file) throught modules so easydiscuss items ("topics") will look consistent, the same on our entire website.

To put it simply, what i want is basically this: replicate the layout of frontpage.post.php file inside mod_recentdiscussions, detault.php template file. I attached my frontpage.post.php file to this reply, if you want to see it.

I am fighting a war, real struggle, to replicate this layout across proprietary easydiscuss modules because we try to obtain consistency across the entire website.
In their default state, the modules are developed to "bare minimum". It would be great if any code that works inside the core easydiscuss template would work in the modules too.
·
Thursday, 26 June 2014 18:35
·
0 Likes
·
0 Votes
·
0 Comments
·
Just a quick case
For example try to use this code in default.php module template file. I use it succesfully inside frontpage.post.php file

*the code gets the post first attachment, if attachment exist it will display it, if not it will display another img

<?php
$attachments = $post->getAttachments();
$attachment = isset( $attachments[ 0 ] ) ? $attachments[ 0 ] : false;
?>


and then try to output somewhere the first attachment image

    <?php if ( $attachment ) {?>
<img width="100%" alt="Cover" data-src="<?php echo JURI::root() . 'index.php?option=com_easydiscuss&controller=attachment&task=displayFile&tmpl=component&size=thumb&id=' . $attachment->id;?>" src="/assets/image/green.jpg" data-toggle="unveil" class="unveiled">
<?php } else { ?>
<img width="100%" alt="Cover" data-src="/assets/image/green.jpg" src="/assets/image/green.jpg" data-toggle="unveil" class="unveiled">
<?php } ?>


As soon as you use the first php code ... the page where the module is used will throw error (white page error)


Something is not right in the way modules works, were built

Another example i have is with mod_easydiscuss_similar_discussions
On this module, a really simple stuff like geting and displaying the post author avatar ... will throw up errors.

<?php echo $post->user->getAvatar();?>



Maybe you can teach me a small trick on how can i "enable" ... something, some hidden gem inside the module files (perhaps helper.php file) that will "activate" the entire post information so i can use the same code i use inside frontpage.post.php file

PS: I love the products and we are building a COOL and GREAT community with them. I can send you some links in private if you want to see how far we went. Stackideas products ... can really make a difference ! Joomla can look different ... and so on.
·
Thursday, 26 June 2014 18:47
·
0 Likes
·
0 Votes
·
0 Comments
·
Same thing ... with mod_easydiscuss_similar_discussions

In the template file (default.php) showing the post title, works

<?php echo $post->title; ?>


but if you try to output the introtext for example

<?php echo $post->introtext; ?>


or views count

<?php echo $post->hits; ?>


it does not work.


Even "better" than that, try to output the author with

<?php echo $this->escape( $post->user->getName() );?>


or

<?php echo $post->user->getName();?>


and from the errors you get, you will be amased how little on informations these modules were thought and built in the first place.

I think you guys build the modules to just output extremely few post informations.
Oh man, even the views count is not working )))))

So any "magic" to make this modules work as they should would be great !
If we can't output the needed post informations in modules, the modules are pretty much useless.
A module that shows only the post title (just an analogy) .... it's almost equal to zero.
·
Thursday, 26 June 2014 23:55
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Mist,

Thanks for the file but it seems like it is not the default.php from the module. We need to check the default.php which is modified by you and will try to solve the variable issue. Perhaps, you might want to include comments in your file so we can identify which variable you want it to displayed.

Also, kindly please understand that this is beyond the scope of our support.
·
Monday, 30 June 2014 09:39
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post