Page 1 of 2

Can I redirect comment feedback to another site?

Posted: Fri Dec 18, 2009 9:25 am
by schimanke
This is the short version: I have created a special view of the comment form to make it nicely usable from the iPhone. Everything works just fine, so comments are posted perfectly. My question now is if there is any way to redirect the positive or negative feedback that is shown after posting a comment to another site.

And now the long verison: To make the commentform look nice on the iPhone, I use php to cut just the form out of the complete site and display it with a special css for the iPhone. You can see it here:
Entering information and posting it to an entry works just fine. But after posting the comment the user is redirected to the blog entry showing a feedback for the operation (for example http://www.yoursite.com/index.php?url=a ... e#feedback). What I'd like to do is to redirect just this comment (for example "Kommentar wurde hinzugefügt" / "Comment was added") to a blank site which does not do anything but to show this feedback. Is that possible?

Re: Can I redirect comment feedback to another site?

Posted: Fri Dec 18, 2009 10:09 am
by garvinhicking
Hi!

You could edit the .tpl files to add checks like: {if NOT $smarty.request.csuccess}...{/if} around the containers / HTML structures that you don't want to show, when that page is shown.

HTH,
Garvin

Re: Can I redirect comment feedback to another site?

Posted: Thu Dec 24, 2009 10:58 am
by schimanke
Thanks for your help, garvin!

But I am afraid that I don't really know how to do this. :-(
By the way, the web view of my blog should stay as it is. I just want the feedback to be displayed on a standalone site. Just the feedback, nothing else. When I edit my .tpl file I guess that this also affects the output of my blog in the browser, right? That should not happen. Again, I just need the feedback to be shown on an own site. Is that possible?

Re: Can I redirect comment feedback to another site?

Posted: Sat Dec 26, 2009 12:42 am
by garvinhicking
Hi!
But I am afraid that I don't really know how to do this. :-(
Oh, okay. Your post made the impression you were somewhat familiar with HTML and maybe basic Smarty operation.

Sadly I don't have the time to create a walkthrough for you right now. Maybe if you remind me after new year, I can try to post you with precise code examples.

You can embed an easiy UserAgent sniffer inside a config.inc.php file of your template that sets a special variable when an iphone browser is detected, so that the statement would also check for that variable to not influence the web view.

Regards,
Garvin

Re: Can I redirect comment feedback to another site?

Posted: Sat Dec 26, 2009 11:14 am
by schimanke
Thanks again!

I guess I will get back to you after new year...

Happy Holidays!

Re: Can I redirect comment feedback to another site?

Posted: Wed Jan 06, 2010 6:56 pm
by schimanke
Hi Garvin,

first of all I wish you a happy new year!
Just as promised, I'd like to get back to you concerning my problem. Here are two screenshots which show you what I have accomplished up to now. Everything works fine so far. The only remaining problem is still that when I tap on "Kommentar abschicken", as the next step the whole website is displayed including the comment feedback. What I'd like to have there instead is a blank site with nothing but only the comment feedback. Do you have any ideas, examples, help?

Image Image

I guess I am pretty familiar with HTML and I think I could also embed the mentioned UserAgent sniffer to detect an iPhone, but I don't know how to use this to display the comment feedback on a blank site.

Thanks for your help!!!

Re: Can I redirect comment feedback to another site?

Posted: Thu Jan 07, 2010 9:06 am
by rekk1986
this question is so interesting. I 'm finding the solutions to this. And finally i found here. Thanks schimanke for your support.

Re: Can I redirect comment feedback to another site?

Posted: Thu Jan 07, 2010 6:05 pm
by garvinhicking
Hi!

So once the feedback is created, the s9y variable "$is_comment_added" will get set.
You can use this variable to hide all other content that would be usually displayed. To circumvent that, it's best to be placed within the "content.tpl" template file.

This one usually already has some "shortcut output":

Code: Select all

{if $searchresult_tooShort}
    <h3 class="serendipity_date">{$CONST.QUICKSEARCH}</h3>
        <div class="serendipity_search serendipity_search_tooshort">{$content_m
{elseif $searchresult_error}
...
for search results, etc. Now, you simply add one elseif line to match the "comment added routine":

Code: Select all

{if $searchresult_tooShort}
    <h3 class="serendipity_date">{$CONST.QUICKSEARCH}</h3>
        <div class="serendipity_search serendipity_search_tooshort">{$content_m
{elseif $is_comment_added}
    <div>Your custom content here.</div>
{elseif $searchresult_error}

Now, after that you would still get the normal content due to this:

Code: Select all

{$ENTRIES}
{$ARCHIVES}
so you have to modify it to not show when a comment has been added:

Code: Select all

{if NOT $is_comment_added}
{$ENTRIES}
{$ARCHIVES}
{/if}
HTH,
Garvin

Re: Can I redirect comment feedback to another site?

Posted: Thu Jan 07, 2010 10:05 pm
by schimanke
Hi Garvin,

thanks again. Your solution does pretty much what I wanted to have. Though there is still a lot of stuff around the feedback message which I actually do not need, but I can live with that. Using a UserAgent sniffer to detect an iPhone browser and remove the stuff around the message would not be a good solution since I also offer my users to view the "real" website inside the iPhone browser. So what you see in the screenshot below might be the most appropriate solution right now...

Anyway, there is another question now. As you suggested, I have added the following to my content.tpl:

Code: Select all

{elseif $is_comment_added}
<h3 class="serendipity_msg_notice">{$CONST.COMMENT_ADDED}</h3>
which does what it should as you can see in the following screenshot:

Image

But I need some more solutions for two other scenarios. There also needs to be a feedback message if the comment was empty and a feedback if wrong captchas were entered. What would be the code I need to add to the content.tpl for those two scenarios?

Thanks in advance!

Re: Can I redirect comment feedback to another site?

Posted: Fri Jan 08, 2010 5:29 pm
by garvinhicking
Hi!

You might want to simply check the entries.tpl template, search for "is_comment_added". There you'll see the other variables which can be checked to output the specific error/success messages ($comment_messagestack).

HTH,
Garvin

Re: Can I redirect comment feedback to another site?

Posted: Sat Jan 09, 2010 2:23 pm
by schimanke
Hi Garvin,

I've already checked my entries.tpl but could not find a solution for the case that a comment could not be added due to the fact that it was empty or that wring captchas were entered. All I could find was an option for moderated comments, for closed comments and for disabled comments. Anyway, when a visitor leaves the commtents-field empty or enters a wrong captcha, there is a feedback (or error message) on the "normal" website. That is what I need in the same style like the positive feedback, which we have already solved. Any ideas?

Thanks!

Re: Can I redirect comment feedback to another site?

Posted: Sat Jan 09, 2010 3:47 pm
by garvinhicking
HI!

comment_messagestack, as I referred to?!

Regards,
Garvin

Re: Can I redirect comment feedback to another site?

Posted: Sun Jan 10, 2010 2:36 pm
by schimanke
Hi Garvin,

I'm afraid, I just don't get it... :-(
Okay, here is how I understand what is going on. As I said, this is what I added to my content.tpl:

Code: Select all

{elseif $is_comment_added}
<h3 class="serendipity_msg_notice">{$CONST.COMMENT_ADDED}</h3>
and then later on

Code: Select all

{if NOT $is_comment_added}
{$ENTRIES}
{$ARCHIVES}
{/if}
From my point of view (please correct me if I'm wrong) this only applies to a scenario where a comment is really added to the site, i.e. everything went fine. But what can I do when something went wrong, for example the comment-field was left empty or wrong captchas were entered, and the comment was not added to the side. Is in that case $is_comment_added still set? As far as I understand it is not, is it?

So what I found in my entries.tpl is this:

Code: Select all

{foreach from=$comments_messagestack item="message"}
<div class="serendipity_center serendipity_msg_important">{$message}</div>
{/foreach}
which from my point of view displays the negative feedback in red letters.

So far, so good but how can I check this negative scenario? The positive one gets checked by $is_comment_added and then later on it is determined whether everything should be displayd or just the feedback by

Code: Select all

{if NOT $is_comment_added}
I still don't know how to remove everything but the feedback in the described negative scenario. Here is what my content.tpl looks like right now:

Code: Select all

<!-- CONTENT START -->

{if $searchresult_tooShort}
    <h2 class="serendipity_date">{$CONST.QUICKSEARCH}</h2>
	<div class="serendipity_search serendipity_search_tooshort">{$content_message}</div>
{elseif $is_comment_added}
<h3 class="serendipity_msg_notice">{$CONST.COMMENT_ADDED}</h3>
{elseif $searchresult_error}
    <h2 class="serendipity_date">{$CONST.QUICKSEARCH}</h2>
	<div class="serendipity_search serendipity_search_error">{$content_message}</div>
{elseif $searchresult_noEntries}
    <h2 class="serendipity_date">{$CONST.QUICKSEARCH}</h2>
	<div class="serendipity_search serendipity_search_noentries">{$content_message}</div>
{elseif $searchresult_results}
    <h2 class="serendipity_date">{$CONST.QUICKSEARCH}</h2>
	<div class="serendipity_search serendipity_search_results">{$content_message}</div>
{else}
	<div class="serendipity_content_message">{$content_message}</div>
{/if}

{if NOT $is_comment_added}
{$ENTRIES}
{$ARCHIVES}
{/if}

<!-- CONTENT END -->
What do I have to add to it to get everything but the negative feedback removed, just like it already works for the positive feedback?

Thanks again!

Re: Can I redirect comment feedback to another site?

Posted: Sun Jan 10, 2010 5:20 pm
by garvinhicking
Hi!

Just like $is_comment_added, you add a if $comments_messagestack to your content.tpl. Maybe "if $comments_messagestack|@count > 0" if the first doesn't work.

So it's all just a matter of checking, if that variable is set, and conditionally showing/hiding things depending on that simple "if" check, and extending existing IF-clauses. Sorry if I was not being verbose enough, since you got a lot of things solved already I was thinking those small pointers would have been sufficient ;)

HTH,
Garvin

Re: Can I redirect comment feedback to another site?

Posted: Wed Jan 13, 2010 8:09 pm
by schimanke
Hi Garvin,

thank you very much, now it works! It is not as I wanted it to look like when I started but it is a good compromise. To close this matter here is what my content.tpl looks like right now:

Code: Select all

<!-- CONTENT START -->

{if $searchresult_tooShort}
    <h2 class="serendipity_date">{$CONST.QUICKSEARCH}</h2>
	<div class="serendipity_search serendipity_search_tooshort">{$content_message}</div>
{elseif $is_comment_added}
	<p align=center><font size="10" class="serendipity_msg_notice">{$CONST.COMMENT_ADDED}</font></p>
{elseif $comments_messagestack|@count > 0}
	<p align=center><font size="10" class="serendipity_msg_important">{$message}.</font></p>
{elseif $searchresult_error}
    <h2 class="serendipity_date">{$CONST.QUICKSEARCH}</h2>
	<div class="serendipity_search serendipity_search_error">{$content_message}</div>
{elseif $searchresult_noEntries}
    <h2 class="serendipity_date">{$CONST.QUICKSEARCH}</h2>
	<div class="serendipity_search serendipity_search_noentries">{$content_message}</div>
{elseif $searchresult_results}
    <h2 class="serendipity_date">{$CONST.QUICKSEARCH}</h2>
	<div class="serendipity_search serendipity_search_results">{$content_message}</div>
{else}
	<div class="serendipity_content_message">{$content_message}</div>
{/if}

{if NOT $is_comment_added}
{if NOT $comments_messagestack|@count > 0}
{$ENTRIES}
{$ARCHIVES}
{/if}
{/if}

<!-- CONTENT END -->
Thanks again for your ongoing support!