I have a social network that has custom made comments section for users. Users are also able to reply to comments. Each comment has a 'reply' button that when pressed, uses jquery to make a new text box structure appear.
It is a bit lengthy in syntax and logic so I am a bit lost on what the problem may be ( it is not functioning at all. I have also run out of trouble shoot methods.
Here is the code for the comments and replies:
<div id="x_comment_box">
<form name="x_comment_form" method="post" action="Project-X.php">
<textarea name="comment_body" class="round_10px defaulted">Leave a comment about "Name of Video"...</textarea>
<input type="submit" name="x_submit" value="Submit" class="post"/>
</form>
</div>
<?php
$query = "SELECT * FROM `x_comments` WHERE `status` = 'active' ORDER BY `date` DESC, `time` DESC LIMIT 10";
$request = mysql_query($query,$connection) or die(mysql_error());
while($result = mysql_fetch_array($request)) {
$webcast_poster = new User($result['userID']);
$body = $result['commentBody'];
$date = $result['date'];
$time = $result['time'];
$comment_id = $result['id'];
?>
<div class="comment_structure_future_webcast_x clearfix">
<a name="comment_<?php echo $result['id']; ?>"></a>
<div class='comment_polaroid_future'>
<a href='http://www.cysticlife.org/Profile.php?id=<?php echo $poster->id ?>'>
<img src='<?php echo $webcast_poster->img('mini'); ?>' border='0'/>
</a>
</div>
<div class='comment_body_future_webcast_x round_10px'>
<div id='CommentNameProfile'>
<a href='http://www.cysticlife.org/Profile.php?id=<?php echo $auth->id; ?>'>
<?php echo $webcast_poster->first_name. " ". $webcast_poster->last_name; ?> says...
</a>
</div>
<?php echo strip_tags(stripslashes(nl2br($result['commentBody'])),'<br><br />'); ?>
<div id='CommentInfoProfile'>
<?php echo date('M d, Y',strtotime($result['date'])); ?> at <?php echo date('g:i A',strtotime($result['time'])); ?> •
<?php if($webcast_poster->id == $auth->id) { ?>
<a href='#' onclick='confirmation("DeleteWebcastComment.php?id=<?php echo $result['id']; ?>&ret=<?php echo urlencode($_SERVER['REQUEST_URI']); ?>");'>Delete •</a>
<?php } ?>
<a href='#reply_form_<?php echo $result['id']; ?>' name='reply_to_<?php echo $result['id']; ?>' class='reply_link'>Reply</a>
</div>
</div>
<div class='profile_comment_tail_future'> </div>
</div>
<?php }?>
<?php
/* responses */
$query = "SELECT
*
FROM
`x_comments_replies`
WHERE
`commentID` = '" . $result['id'] . "'
&& `status` = 'active'
ORDER BY `date` ASC, `time` ASC";
$request2 = mysql_query($query,$connection);
while($reply = mysql_fetch_array($request2)) {
$replier = new User($reply['replierID']);
?>
<div class="response_structure_future">
<a name="response_<?php echo $reply['id']; ?>"></a>
<div class="response_polaroid_future">
<a href="http://www.cysticlife.org/Profile.php?id=<?php echo $replier->id; ?>">
<img src="<?php echo $replier->img('mini'); ?>" />
</a>
</div>
<div class="response_body_future round_10px">
<div class="response_arrow_future"></div>
<div class="response_tail_future"></div>
<div class="response_data_future">
<div class="response_name_future">
<a href="http://www.cysticlife.org/Profile.php?id=<?php echo $replier->id; ?>">
<?php echo $replier->first_name . " " . $replier->last_name; ?> says...
</a>
</div>
<?php echo strip_tags(stripslashes(nl2br($reply['comment'])),'<br><br />'); ?>
<div class="response_info_future">
<?php echo date('M d, Y',strtotime($reply['date'])); ?> at <?php echo date('g:i A',strtotime($reply['time'])); ?>
<?php if($auth->id == $replier->id || $auth->id == $result['ToUserID']) { ?>
<a onclick="confirmation('DeleteAirwaveReply.php?id=<?php echo $reply['id']; ?>&ret=<?php echo urlencode($_SERVER['REQUEST_URI']); ?>');"> • delete</a>
<?php } ?>
<div id="thumb_holder_replies">
<div id="thumb_report_replies">
<a href="mailto:info#cysticlife.org">
report
</a>
</div>
<div class= "thumb_counter_replies" id="thumb_counter_replies_<?php echo $reply['id']; ?>">
+<?php echo $reply['thumbsUp_reply']; ?>
</div>
<div id="thumb_thumb_replies">
<?php $comment_reply_id = $reply['id'];?>
<a class="myButtonLink" href="Profile_test.php?id=<?php echo $prof->id; ?>" id="<?php echo $comment_reply_id; ?>">Vote Up!</a>
<?php echo $replier->id; ?>
<?php print_r($replier->id); ?>
<?php echo $result['id']; ?>
</div>
</div>
</div>
</div>
</div>
</div>
<?php } ?>
<a name='reply_form_<?php echo $result['id']; ?>' style="clear:both"></a>
<div id='reply_to_<?php echo $result['id']; ?>' class="respond_structure_future" <?php if(isset($_GET['reply_to']) && $_GET['reply_to'] == $result['id']) { echo 'style="display:block;"';}else{ echo 'style="display:none;"';} ?>>
<div class="respond_polaroid_future">
<a href="http://www.cysticlife.org/Profile.php?id=<?php echo $auth->id; ?>">
<img src="<?php echo $auth->img('mini'); ?>" />
</a>
</div>
<form name='comment_reply' action='<?php echo $_SERVER['REQUEST_URI']; ?>' method='post'>
<div class="respond_body_future round_10px">
<div class="respond_arrow_future"></div>
<div class="respond_tail_future"></div>
<div class="respond_data_future">
<textarea id="reply_to_<?php echo $result['id']; ?>_textarea" name='reply'></textarea><br />
<input type='hidden' name='comment' value='<?php echo $result['id']; ?>' />
<div class="respond_nevermind">
nevermind
</div>
<input type='submit' class="submit" name='sub_comment_reply' value='Reply' />
</div>
</div>
</form>
</div>
Here is the jquery:
<script type="text/javascript">
$(document).ready( function() {
$('#Comments').localScroll({ offset:{top:-40,left:0} });
$("a.reply_link").click( function() {
$("#"+$(this).attr('name')).fadeIn('slow');
});
$(".respond_nevermind a").click( function(event) {
event.preventDefault();
var reply_box = document.getElementById($(this).attr('href'));
$(reply_box).css('display','none');
var reply_textarea = document.getElementById($(this).attr('href')+"_textarea");
$(reply_textarea).val('');
});
});
</script>
thanks in advance
Related
I have a block being displayed on my homepage which shows a product, whose id we specify. The code on homepage (static block) looks like this:
{{block type="core/template" product_id="2559" template="catalog/product/one_product.phtml"}}
The one_product.phtml file contains this code:
<?php
$productId = $this->getProduct_id();
$product = Mage::getModel('catalog/product')->load($productId); //load product
?>
<div class="product">
<a href="<?php echo $product->getProductUrl() ?>" >
<img class="product-img" src="<?php echo $this->helper('catalog/image')->init($product, 'image'); ?>"alt="<?php echo $this->htmlEscape($product->getName()) ?>" />
</a>
</div>
<div class="product-detail">
<P><?php // echo $this->htmlEscape($product->getName()) ?>
<?php $prod_name = $this->htmlEscape($product->getName()); ?>
<?php
$count_str = strlen($prod_name);
if ($count_str < 40) {
echo $prod_name;
} else {
$offset = 0;
$length = 41;
$prod_name = html_entity_decode($prod_name);
echo htmlentities(mb_substr($prod_name,0,$length,'utf-8')). "...";;
}
?>
</P>
<!--?php $price = $product->getPrice() ; ?-->
<?php $_product = Mage::getModel('catalog/product')->load($product->getId());
$productBlock = $this->getLayout()->createBlock('catalog/product_price');
?>
<span>
<?php echo $productBlock->getPriceHtml($_product); ?>
<?php $tier_price = end($_product->getTierPrice());
if($tier_price !='0'){ ?>
<span>As Low As:</span>
<?php
echo " ₹ ".number_format( $tier_price['price']);
} ?>
<button type="button" title="<?php echo $this->__('Add to Cart') ?>" class="button btn-cart"
onclick="setLocation('<?php echo Mage::helper('checkout/cart')->getAddUrl($product); ?>')">
</span>
</div>
So basically I want to show random products out of the ones I specify separated by commas. For eg: I specify in the static block product_id="2559,2661,2857,9293" and it should show any one of those 4 products randomly.
What is the way to do that?
Also any way to make it pull products from SKU also? Since we remember all the SKUs but we have to check each product ID everytime we change the product here.
Please excuse me if the question is too basic, I'm not a developer.
You can see it in action at www.giftzila.com
Thanks!
Create a new file called random-product.phtml at app/design/frontend/default/Your_Theme/template/catalog/random-product.phtml then add the following code in that file
<?php
$chosen_category = Mage::getModel('catalog/category')->load($this->getCategoryId());
$_productCollection = $this->getLoadedProductCollection();
$number_of_products = $this->getNumProducts();
if (sizeof($_productCollection) < $number_of_products) {
$number_of_products = sizeof($_productCollection);
}
$displayed_products = array();
foreach ($_productCollection as $_product) {
$displayed_products[] = $_product;
}
$random_products = array();
if (sizeof($_productCollection) > 1) {
$random_products = array_rand($displayed_products, $number_of_products);
} else {
$random_products = array('0');
}
?>
<?php if(!$_productCollection->getSize()):?>
<div class="note-msg">
<?=$this->__('There are no products matching the selection.')?>
</div>
<?php else:?>
<div class="main-binder">
<div class="cms-box">
<div class="category-title">
<h2>Random Products</h2>
</div>
<div class="category-products">
<table id="products-grid-table" class="products-grid">
<?php
$k=0;
for ($i=0; $i < $number_of_products; $i++): ?>
<?php if ($k == 0) { ?>
<tr class="first odd">
<?php } if($k==3) { $k=0; ?>
</tr><tr class="first odd even">
<?php } ?>
<td id="td_<?php echo ($k+1); ?>" <?php if($k==3){ ?>class="last"<? } ?> >
<div class="cms-box">
<div id="cont_<?php echo ($k+1); ?>">
<div class="product-name-block">
<?php
$pname=$this->htmlEscape($displayed_products[$random_products[$i]]->getName());
?>
<h3 class="product-name">
<a href="<?php echo $displayed_products[$random_products[$i]]->getProductUrl()?>" title="<?php echo $pname; ?>">
<?php if(strlen($pname) > 28) {echo substr($pname,0,25)."...";}else {echo $pname;}?>
</a></h3>
</div>
<div class="image-box">
<a class="product-image" href="<?php echo $displayed_products[$random_products[$i]]->getProductUrl()?>"> <img src="<?php echo $this->helper('catalog/image')->init($displayed_products[$random_products[$i]], 'small_image')->resize(140);?>" alt="<?php echo $this->htmlEscape($displayed_products[$random_products[$i]]->getName())?>" title="<?php echo $this->htmlEscape($displayed_products[$random_products[$i]]->getName())?>"/> </a>
</div>
<div class="cms-price-box" style=" text-align:center;">
<span class="regular-price" id="product-price-37">
<span class="price" ><?php echo Mage::app()->getLocale()->currency(Mage::app()->getStore()->
getCurrentCurrencyCode())->getSymbol().$displayed_products[$random_products[$i]]->getPrice(); ?></span>
</span>
</div>
<div class="button-row" style="text-align:center;">
<button onclick="setLocation('<?php echo $displayed_products[$random_products[$i]]->getProductUrl();?>')" class="button" type="button"><span><span><span>Details</span></span></span></button>
<button onclick="setLocation('<?php echo $this->getUrl('')."/checkout/cart/add?product=".$displayed_products[$random_products[$i]]->getId()."&qty=1" ?>')" class="button"><span><?php echo $this->__('Add to Cart') ?></span></button>
</div>
</div>
</div></td>
<?php $k++; ?>
<?php endfor;?>
</tr>
</table>
</div>
</div>
</div>
<?php endif;?>
Now call block in your cms home page by adding following code:-
{{block type="catalog/product_list" category_id="3" num_products="8" template="catalog/random-product.phtml"}}
I have a page where i generate a multiple ID's and i put in page, is ads page like that:
if you see in my page i have that message: The number is: 1 after every ad
I want to increment that number, i try this but i can when de page is in loading my x is alwais 1:
<?php
$x = 1;
if($x <= 5) {
echo "The number is: $x <br>";
$x++;
}
?>
I want to increment always in my page 1,2,3,4,5 not always 1, but how can i do
Above i put all my code from page:
<?php
global $ae_post_factory, $user_ID;
$place_obj = $ae_post_factory->get('place');
$post = $place_obj->current_post;
// et_location_lat et_location_lng
?>
<?php
$query = $wpdb->get_var('SELECT count(*) as featured FROM `eHouTHuQpostmeta` WHERE `post_id`=' . get_the_ID() . ' and meta_key = "et_featured" and meta_value=1');
$date = $wpdb->get_var('SELECT meta_value FROM `eHouTHuQpostmeta` WHERE `post_id`=' . get_the_ID() . ' and meta_key = "et_twitter_url" ');
$hour = $wpdb->get_var('SELECT meta_value FROM `eHouTHuQpostmeta` WHERE `post_id`=' . get_the_ID() . ' and meta_key = "et_google_url" ');
?>
<li <?php post_class( 'post-item' ); ?> >
<div style="width:100%">
<div style="float:left;width:50%">
<?php if($query == 1){ ?><STRONG>SUGGESTED</STRONG><?php } ?>
</div>
<div style="float:right;width:50%;text-align:right">
<?php
if($date != "" && $hour != ''){
echo "<span id='data-time'>" . $date . "</span>";
}
?>
</div>
<div style="clear:both"></div>
</div>
<div class="place-wrapper<?php if($query == 1){ echo " featured-box"; } ?>">
<a href="<?php the_permalink(); ?>" class="img-place">
<img src="<?php echo $post->the_post_thumnail; ?>" alt="<?php the_title(); ?>"/>
<?php if(isset($post->et_google_url) && $post->et_google_url){ ?>
<div class="cat-<?php echo $post->place_category[0]; ?>">
<div class="ribbon">
<span class="ribbon-content"><?php echo $post->et_google_url; ?></span>
</div>
</div>
<?php } ?>
</a>
<div class="place-detail-wrapper">
<h2 class="title-place"> <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?>
</a></h2>
<span class="address-place">
<i class="fa fa-map-marker"><span itemprop="latitude" id="latitude" content="<?php echo $post->et_location_lat;?>"></span></i>
<span itemprop="longitude" id="longitude" content="<?php echo $post->et_location_lng;?>"></span>
<span class="distance"></span>
<?php echo $post->et_full_location; ?>
</span>
<span class="address-place">
<?php echo strip_tags(html_entity_decode(get_the_excerpt())); ?>
<hr>
</span>
<div class="rate-it" data-score="<?php echo $post->rating_score; ?>">
</div>
<?php
if (!empty($post->et_fb_url)) {
echo "<span class='imageContainer'> <i class='fa fa-usd' style=''>" . $post->et_fb_url . '</i></span>';
}
?>
</i>
</div>
<?php
if(#wp_get_current_user()->user_login == get_the_author())
{
?>
<!--<div class="place-config">
<i class="fa fa-cog edit-config"></i>
<img src="http://romanianusa.com/wp-content/uploads/2015/12/1450310691_6.png" class="edit-config" style="width:22px;height:22px;">
</div>
<div class="edit-place-post">
<a href="http://romanianusa.com/post-place?id=<?php the_ID(); ?>"><i class="fa fa-history place-remove fa-3x" style="padding-right:50px"></i>
<i class="fa fa-pencil place-edit fa-3x" style="padding-right:50px; padding-top:15px"></i>
<i class="fa fa-trash-o place-remove fa-3x" style="padding-top:15px"></i>
<br>
<span style="padding-right:52px">Repost</span>
<span style="padding-right:52px;">Edit</span>
<span style="padding-right:8px;">Trash</span>
</div>-->
<?php
}
?>
</div>
<?php
$x = 1;
if($x <= 5) {
echo "The number is: $x <br>";
}
$x++;
?>
<?php
if (!empty($post->et_url)) {
?>
<!--<center><span id="flag"><?php echo $post->et_url; ?></span></center>-->
<center><?php echo $post->et_url; ?></center>
<?php
}
?>
</li>
I'm having this comment form. this comment form works but not correctly whenever I post comment it works on 1 post and on another it refreshes the page and data is also not inserted all the post are fetch by while loop
JS:
< script type = "text/javascript" >
$(function() {
$("#submit").click(function() {
var mcomment = $("input#mcomment").val(); // define the name variable
var mesgid = $("input#mesgid").val();
if (mcomment == '') // if name field is empty
{
alert("Write Comment Please."); // alert an error mesaage
} else {
$.ajax({ // JQuery ajax function
type: "POST", // ajax submit method
url: "status/savecomment.php",
data: 'mcomment=' + mcomment + '&mesgid=' + mesgid, // data sent to php file
cache: false,
success: function(html) { // if the result returns success
$("#comment_display").after(html);
}
});
}
return false;
});
});
< /script>
HTML:
<form method="POST" id="commentform">
<div class="panel-footer p15">
<div class="admin-form">
<img src="image.png">
<label for="reply1" >
<input name="mesgid" id="mesgid" type="hidden" value="
<?php echo $id ?>">
<input name="mcomment" id="mcomment" placeholder="Respond with a
comment." type="text" style="width:130%;">
</label>
<button type="submit" id="submit" class="button
btn-primary submit-btn" name="" style="width:90px; margin-
left:50px;">Comment</button>
</div>
</div>
</form>
here is all new edited code
<?php
$msql=mysql_query("SELECT * from `messages` ORDER BY `msg_id` DESC LIMIT
$post_limit");
while($messagecount=mysql_fetch_array($msql))
{
$id=$messagecount['msg_id'];
$msgcontent=$messagecount['message'];
$usermsg=$messagecount['username'];
$userimg=$messagecount['image'];
$userimg1=$messagecount['user_img'];
$usertime=$messagecount['time'];
?>
<i class="pointer" id="pagination-<?php echo $id;?>"></i>
<div style="display: block;" class="timeline-item" id="clone-3">
<div class="panel">
<div class="panel-heading">
<span class="panel-title" style="color:#000;"><?php echo
ucfirst($usermsg); ?> Updated a </span><a href="post.php?id=<?php echo
$id;?>">Post</a>
<span class="panel-date pull-right mr10 text-muted fs12">
<?php echo timeAgo($messagecount['time']);?> via Web</span>
</div>
<div class="panel-body">
<p><img src="image.php/<?php echo $userimg1;?>?width=60&
height=70&nocache&quality=100&image=http://localhost/niftians/profile
/upload/<?php echo $userimg1;?>" /> <?php echo
parse_smileys(make_clickable(nl2br(stripslashes($msgcontent))),
$smiley_folder); ?><br><br><?php if(!empty($messagecount['image'])) { ?>
<img src="status/image.php/<?php echo
$messagecount['image'];?>?width=350&nocache&quality=100&
image=http://localhost/niftians/profile/upload/<?php echo
$messagecount['image'];?>" style="margin-left:10%;">
<?php } ?></p>
</div>
</div>
</div>
<?php
$sql=mysql_query("select * from comments where msg_id_fk='$id' order by
com_id");
$comment_count=mysql_num_rows($sql);
if($comment_count>2)
{
$second_count=$comment_count-2;
?><div class="comment_ui" id="view<?php echo $id; ?>">
<div>
<a href="#" class="view_comments" id="<?php echo $id; ?>">View all <?php
echo $comment_count; ?> comments</a>
</div>
</div>
<?php
}
else
{
$second_count=0;
}
?>
<div id="view_comments<?php echo $id; ?>"></div>
<div id="two_comments<?php echo $id; ?>">
<?php
$listsql=mysql_query("select * from comments where msg_id_fk='$id' order
by com_id limit $second_count,2 ");
while($rowsmall=mysql_fetch_array($listsql))
{
$c_id=$rowsmall['com_id'];
$comment=$rowsmall['comments'];
$userid3=$rowsmall['username'];
$userimg5=$rowsmall['user_img'];
$usercom=$rowsmall['time'];
?> <div id="comment_display"></div>
<div class="media mt15" id="aniket">
<a class="pull-left" href="#"> <img class="media-
object thumbnail thumbnail-sm rounded mw40" src="image.php/<?php echo
$userimg5;?>?width=60&height=60&nocache&quality=100&
image=http://localhost
/niftians/profile/upload/<?php echo $userimg5;?>" alt="..."> </a>
<div class="media-body mb5">
<h5 class="media-heading mbn"><a href="<?php echo
$userid3; ?>"><?php echo ucfirst($userid3); ?></a>
<small> -<?php echo timeAgo($rowsmall['time']);?>
</small>
</h5>
<p><?php echo
parse_smileys(make_clickable(nl2br(stripslashes($comment))),
$smiley_folder); ?></p>
</div>
</div>
<?php } ?>
</div>
<form method="POST" id="commentform">
<div class="panel-footer p15">
<div class="admin-form">
<img src="image.php/<?php echo $info->img;?>?width=45&nocache&
quality=100&image=http://localhost/niftians/profile/upload/<?php echo
$info->img;?>">
<label for="reply1" >
<input name="mesgid" id="mesgid" type="hidden" value="<?php echo $id ?>">
<input name="mcomment" id="mcomment" placeholder="Respond with a
comment." type="text" style="width:130%;">
</label>
<button type="submit" id="submit" class="button
btn-primary submit-btn" name="" style="width:90px; margin-
left:50px;">Comment</button>
</div>
</div>
</form>
<br>
<?php
}
?>
What you need to do is
Remove Submit Button and add <input type="button">
2nd create a div in your page named as <div id="comment_display"></div>
And if this does not solve problem, post your While loop.
Replace this line
$("#submit").click(function() {
with
$("#submit").on('.submit','click',function(e) {
e.preventDefault();
Note: Your submit can work too, but you would have to stop its default behavior using jquery
My selector when selected all is updating only 1 row? however if i select a row, it cannot be updated? please see my code if something's wrong, needed help.
This is the form:
<form action="read_message.php" method="post">
<div class="pull-right">
<button class="btn btn-info" name="read"><i class="icon-check"></i> Read</button>
Check All <input type="checkbox" name="selectAll" id="checkAll" />
<script>
$("#checkAll").click(function () {
$('input:checkbox').not(this).prop('checked', this.checked);
});
</script>
</div>
<ul class="nav nav-pills">
<li class="active"><i class="icon-envelope-alt"></i>inbox</li>
<li class=""><i class="icon-envelope-alt"></i>Send messages</li>
</ul>
<?php
$query_announcement = mysql_query("select * from message_received
LEFT JOIN user ON user.user_id = message_received.user_id
where message_received.receiver_id = '$session_id' order by date_sent DESC
")or die(mysql_error());
$count_my_message = mysql_num_rows($query_announcement);
if ($count_my_message != '0'){
while($row = mysql_fetch_array($query_announcement)){
$id = $row['message_id'];
$id_2 = $row['message_id'];
$fn = $row['firstname'];
$ln = $row['lastname'];
$status = $row['message_status'];
$sender = $row['user_id'];
$sender_name = $fn.' '.$ln;
$receiver = $row['receiver_id'];
?><div class="alert alert-info">
<div class="post" id="del<?php echo $id; ?>">
<div class="message_content">
<?php echo $row['content']; ?>
</div>
<div class="pull-right">
<?php if ($status == 'read'){
}else{ ?>
<input id="" class="" name="selector[]" type="checkbox" value="<?php echo $id; ?>">
<?php } ?>
</div>
<hr>
Send by: <strong><?php echo $fn.' '.$ln; ?></strong>
<i class="icon-calendar"></i> <?php echo $row['date_sent']; ?>
<div class="pull-right">
<a class="btn btn-link" href="#reply<?php echo $id; ?>" data-toggle="modal" ><i class="icon-reply"></i> Reply </a>
</div>
<div class="pull-right">
<a class="btn btn-link" href="#<?php echo $id; ?>" data-toggle="modal" ><i class="icon-remove"></i> Remove </a>
<?php include("remove_inbox_message_modal.php"); ?>
<?php include("reply_inbox_message_modal_user.php"); ?>
</div>
</div>
</div>
<?php }}else{ ?>
<div class="alert alert-info"><i class="icon-info-sign"></i> No Message Inbox</div>
<?php } ?>
</form>
However, nevermind the isset for reply, the problem is the first function for isset read, what's wrong with the query? this is the function for the selector, read_message.php,
<?php include('connect.php'); ?>
<?php
include('session.php');
if (isset($_POST['read'])){
$id=$_POST['selector'];
$N = count($id);
for($i=0; $i < $N; $i++)
{
$result = mysql_query("update message_received set message_status = 'read' where message_id='$id[$i]'");
}
echo "<script> alert('Successfully Updated') </script>";
echo " <script>location.replace('messages.php')</script>";
}
?>
<?php
if (isset($_POST['reply'])){
$sender = $_POST['sender'];
$receiver = $_POST['receiver'];
$id2=$_POST['id2'];
$qwe = $_POST['qwe'];
mysql_query("update message_received set message_status = 'read' where message_id='$id2'");
mysql_query("insert into message_received (user_id,receiver_id,content,date_sent) values('$receiver','$sender','$qwe',NOW())")or die(mysql_error());
mysql_query("insert into message_sent (receiver_id,user_id,content,date_sent) values('$sender','$receiver','$qwe',NOW())")or die(mysql_error());
echo "<script> alert('Your message has been sent') </script>";
echo " <script>location.replace('messages.php')</script>";
?>
<script>
alert('Message Sent');
window.location ="messages.php";
</script>
<?php
}
?>
this code out put is here....(look at the footer subscribe section )
<?php if(!empty($this->items))foreach($this->items as $level): ?>
<?php
$formatedPrice = sprintf('%1.02f',$level->price);
$dotpos = strpos($formatedPrice, '.');
$price_integer = substr($formatedPrice,0,$dotpos);
$price_fractional = substr($formatedPrice,$dotpos+1);
?>
<div class="level akeebasubs-level-<?php echo $level->akeebasubs_level_id ?>">
<p class="level-title">
<span class="level-price">
<?php if(AkeebasubsHelperCparams::getParam('currencypos','before') == 'before'): ?>
<span class="level-price-currency"><?php echo AkeebasubsHelperCparams::getParam('currencysymbol','€')?></span>
<?php endif; ?>
<span class="level-price-integer"><?php echo $price_integer ?></span><?php if((int)$price_fractional > 0): ?><span class="level-price-separator">.</span><span class="level-price-decimal"><?php echo $price_fractional ?></span><?php endif; ?>
<?php if(AkeebasubsHelperCparams::getParam('currencypos','before') == 'after'): ?>
<span class="level-price-currency"><?php echo AkeebasubsHelperCparams::getParam('currencysymbol','€')?></span>
<?php endif; ?>
</span>
<span class="level-title-text">
<a href="<?php echo JRoute::_('index.php?option=com_akeebasubs&view=level&slug='.$level->slug.'&format=html&layout=default')?>">
<?php echo $this->escape($level->title)?>
</a>
</span>
</p>
<div class="level-inner">
<div class="level-description">
<div class="level-description-inner">
<?php if(!empty($level->image)):?>
<img class="level-image" src="<?php echo JURI::base()?><?php echo trim(AkeebasubsHelperCparams::getParam('imagedir','images/'),'/') ?>/<?php echo $level->image?>" />
<?php endif;?>
<?php echo JHTML::_('content.prepare', AkeebasubsHelperMessage::processLanguage($level->description));?>
</div>
</div>
<div class="level-clear"></div>
<div >
<button onclick="window.location='<?php echo JRoute::_('index.php?option=com_akeebasubs&view=level&slug='.$level->slug.'&format=html&layout=default')?>'">
<?php echo JText::_('COM_AKEEBASUBS_LEVELS_SUBSCRIBE')?>
</button>
</div>
</div>
</div>
<?php endforeach; ?>
this is the language file contain that name
COM_AKEEBASUBS_LEVELS_SUBSCRIBE="Subscribe Now"
I want to name those three sections butons as 6month,12month,24month
How will change the code ?
If you are unable to get the value using PHP, try changing the value of the button's name on page load
Here is the JQUERY
$(document).ready(function){
$('div.akeebasubs-awesome-description').each(function(
substription = $(this).children('H4').html()
button = $(this).parent().next().children('button')
$(button).attr(name,substription.split(' ')[0]+'month')
})
})
and the JAVASCRIPT
divs = document.getElementsByClassName('akeebasubs-awesome-description');
for (var i in divs){
divs[i].parentElement.nextElementSibling.children[0].name = divs[i].children[0].innerHTML.split(' ')[0] + 'month'
}
This will take the text of the H4 and make that the corresponding button's name