Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1] 2

Author Topic: display a message when we are writing a comment "comment has been sent and awai  (Read 4106 times)

adminphp

  • Full Member
  • ***
  • Karma: 4
  • Posts: 150
  • you must be a great snewser .

I want to display a message when we are writing a comment "comment has been sent and awaiting activation" I want to be displayed in another page.Not in the same design (template: index.php).

Example:
When we write comments and push "Send" ..Should display a message "comment has been sent and awaiting activation" In another page like " comment_sent.html".

I have searched in the file snews.php But I did not know how we can do it.

thanks

Logged
“Fifty years of programming language research, and we end up with C++?”

adminphp

  • Full Member
  • ***
  • Karma: 4
  • Posts: 150
  • you must be a great snewser .

up please ...
Logged
“Fifty years of programming language research, and we end up with C++?”

Keyrocks

  • Doug
  • ULTIMATE member
  • ******
  • Karma: 449
  • Posts: 6019
  • Semantically Challenged
    • snews.ca

By default, sNews is a single-template system. Everything generated by every function in snews.php displays in the template (index,php) file.

What you describe seems to be that you want your "comment has been sent and awaiting activation" message to be displayed in a different template than the one generated by your index.php file.

(NOT TESTED)
1.  Create a static page-file in your site root, a complete HTML template with the message you want in it - call it not-approved.html
     This template file will also need a link to your domain's home page so visitors can get back to it.

2.  Search in your snews.php file... within the // COMMENTS function for this string and disable it:
        $commentStatus = s('approve_comments') == 'on' ? l('comment_sent_approve') : l('comment_sent');
    This basically says... "IF approve_comments is Enabled, show the "Sent for Approval" message. ELSE IF NOT Enabled, show the "Comment Sent" message.

3. Under that string, place this code:
Code: [Select]
<?php # do not copy

if (s('approve_comments') == 'on') {
### HERE - PUT SCRIPT TO REDIRECT VISITOR TO URL OF STATIC MESSAGE FILE
} else { echo l('comment_sent'); }

# Do not copy ?>


4.  Now - see the orange message up there...? Replace that with a working script that will direct visitors to the URL of your not-approved.html page.

I don't know if this will actually work but this is how I would try it.

This seems like a lot of extra work to show the message in a different template... especially when it is already taken care of in the existing template and it is only visible for a couple of seconds.
    
« Last Edit: October 24, 2010, 05:59:28 PM by Keyrocks »
Logged
Do it now... later may not come.
-------------------------------------------------------------------------------------------------
sNews 1.6 MESU | sNews 1.6 MEMU

adminphp

  • Full Member
  • ***
  • Karma: 4
  • Posts: 150
  • you must be a great snewser .
« Last Edit: April 15, 2012, 04:10:16 PM by adminphp »
Logged
“Fifty years of programming language research, and we end up with C++?”

adminphp

  • Full Member
  • ***
  • Karma: 4
  • Posts: 150
  • you must be a great snewser .

HMM .. everybody here are busy this days .. but i'm waiting for your reply.
anyway thanks
Logged
“Fifty years of programming language research, and we end up with C++?”

Keyrocks

  • Doug
  • ULTIMATE member
  • ******
  • Karma: 449
  • Posts: 6019
  • Semantically Challenged
    • snews.ca

For sNews 1.6 - Just replace that ### HERE string with this one:
      echo '<meta http-equiv="refresh" content="0; url='.db('website').'comment_sent.htm">';

.... and change comment_sent.htm to whatever the name & extension of your file is in your site's root directory.
« Last Edit: March 14, 2011, 08:56:45 PM by Keyrocks »
Logged
Do it now... later may not come.
-------------------------------------------------------------------------------------------------
sNews 1.6 MESU | sNews 1.6 MEMU

adminphp

  • Full Member
  • ***
  • Karma: 4
  • Posts: 150
  • you must be a great snewser .

great mr. keyrocks its work 100% .. what about if i want that page (comment_sent.html) it content of url that can any visitor come back to the article or to the first page (home page).
actually i want both of them (URL to back to homepage & URL to back to article which i comment about it)

I am sorry for the inconvenience. ..I appreciate you and thank you
Logged
“Fifty years of programming language research, and we end up with C++?”

Keyrocks

  • Doug
  • ULTIMATE member
  • ******
  • Karma: 449
  • Posts: 6019
  • Semantically Challenged
    • snews.ca

actually i want both of them (URL to back to homepage & URL to back to article which i comment about it)

Well... to have a link back to the commented article... that would be more complicated. You would need to use PHP to get the article ID then insert it into the link string.... but you cannot use PHP within an HTML file.

To have a link back to the Home Page in your HTML file, you would need to add an HTML string with the hard-coded link back to your Home URL... for example:
        <p><a href="http://your-domain.com/">Back to Home Page</a></p>
« Last Edit: March 15, 2011, 05:30:49 PM by Keyrocks »
Logged
Do it now... later may not come.
-------------------------------------------------------------------------------------------------
sNews 1.6 MESU | sNews 1.6 MEMU

adminphp

  • Full Member
  • ***
  • Karma: 4
  • Posts: 150
  • you must be a great snewser .
« Last Edit: April 15, 2012, 05:09:15 PM by adminphp »
Logged
“Fifty years of programming language research, and we end up with C++?”

Fred K

  • Still trying to learn stuff
  • ULTIMATE member
  • ******
  • Karma: 130
  • Posts: 2728
    • Personal

It won't work because, as keyrocks explained earlier:
Quote from: keyrocks
you cannot use PHP within an HTML file

To make php code work you must change the filetype of the comment_sent file to .php
And you should also use a correct html construction
Quote
<?php ... ?>
<!DOCTYPE ...>
<html>
<head> ... </head>
<body> ... </body>
</html>
Logged

adminphp

  • Full Member
  • ***
  • Karma: 4
  • Posts: 150
  • you must be a great snewser .

yes i know what are you talking about:
allthings that you've said is right and  I did  the same thing before you told it us..

but i dont know where is problem's main.
and actually when some visitor commented in article  and he press (send)
 must be redirect him to (comment_sent.html/php) which has no rolation with snews file.
not to display to him page of homepage with word (your comment sent) === than it display page (comment_sent.html/php)

i think you know what i'am trying to expalin..

Logged
“Fifty years of programming language research, and we end up with C++?”

nukpana

  • Hero Member
  • *****
  • Karma: 71
  • Posts: 663

I want to display a message when we are writing a comment "comment has been sent and awaiting activation" I want to be displayed in another page.Not in the same design (template: index.php).

Example:
When we write comments and push "Send" ..Should display a message "comment has been sent and awaiting activation" In another page like " comment_sent.html".

I have searched in the file snews.php But I did not know how we can do it.

thanks
Did you check this section?

http://code.google.com/p/snews/source/browse/tags/sNews16/snews.php
Lines 646 - 652:
Code: [Select]
                echo '<h2>'.$commentStatus.'</h2>';
                if (!empty($commentReason)) {echo '<p>'.$commentReason.'</p>';}
                $postCat = clean(cleanXSS($_POST['category']));
                $postArt = clean(cleanXSS($_POST['article']));
                $back_link = db('website').$postCat.'/'.$postArt.'/';
        # 2. 1.6.0 - new string replaces 5 strings in 1.5.31, refreshes content.
                echo '<meta http-equiv="refresh" content="1; url='.db('website').$postCat.'/'.$postArt.'/">';
Logged

Keyrocks

  • Doug
  • ULTIMATE member
  • ******
  • Karma: 449
  • Posts: 6019
  • Semantically Challenged
    • snews.ca

Did you check this section?

That is the section we are discussing... and the suggested mod (that works) is placed after the last line of it.
Logged
Do it now... later may not come.
-------------------------------------------------------------------------------------------------
sNews 1.6 MESU | sNews 1.6 MEMU

adminphp

  • Full Member
  • ***
  • Karma: 4
  • Posts: 150
  • you must be a great snewser .

Quote
Did you check this section?

Seems the code which you gave us.. i think is just for refreshe pages(back to content).
and this code is correct and useful but i can put him in page (comment_sent.html)
as i said there is no relation betwen snews.php file and that page.
if those pages are linked together .. yes we can use the code in that time.. but now aren't .. and what i'am trying to do in my snews CMS is to hide the page which show us sentence (comment sent) i want directly to show page ( comment_sent.html) when the visitor commented at the article.

by the way I've developed a version snews1.6 in excellent image. so I added a lot of features that are not raised in this great forum..
I hope that i have the time to published them to benefit..
« Last Edit: March 18, 2011, 07:36:31 PM by adminphp »
Logged
“Fifty years of programming language research, and we end up with C++?”

Keyrocks

  • Doug
  • ULTIMATE member
  • ******
  • Karma: 449
  • Posts: 6019
  • Semantically Challenged
    • snews.ca

What I showed you was a simple way to redirect to a static page with a static message, with a link back to home.

I don't have any interest in doing this for myself. But, if I did, I would use it in one of my projects (1.6 or 1.7) that already has Bakercad's Switcherizer 2 template system installed. With that, I can create any number of custom templates for special purposes.

I would develop a new function to present a customized message. This function would work like the other hard-coded page-generating functions - like the ones for Sitemap, Archive and Contact - and it would be displayed through the existing center(); function as all sNews content is.

I would then add the new custom function/page to the list of "Fixed Template' pages and, from that Admin panel, choose the template I want the new message page to be displayed in.

That's a whole lot of work if you haven't already got the Switcherizer 2 (or other versatile templating system) installed and running well.

Logged
Do it now... later may not come.
-------------------------------------------------------------------------------------------------
sNews 1.6 MESU | sNews 1.6 MEMU
Pages: [1] 2