TinyMCE Not Rendering in Browser - tinymce
Hi guys i am building a blogging system for my new Social Network and am using TinyMCE to write posts with! for some reason though It does not show up and have no idea why!
I have downloaded the package from their website and uploaded the thing to my server and have made a page called blog_writer.php with the following:
This is the form that contains my text area:
<form method="post" action="blog_writer.php">
<div id="blogMsg"><?php echo $msg; ?></div>
<div id="blogTitle">
Choose a topic:
<select name="topic">
<option value=" "> </option>
<?php
$sql = "SELECT id,name FROM blog_topics ORDER BY name";
$query = mysqli_query($db_conx, $sql) or die (mysqli_error());
while($row = mysqli_fetch_array($query)){
echo '<option value="' . $option[id] . '">' . $option[name] . '</option>';
}?>
</select>
Enter a title:
<input name="title" type="text" size="80" value="<?php echo $title; ?>" />
</div>
<div id="blogContent"><textarea name="blog" id="blog" cols="80" rows="25" class="tinymce"><?php echo $blog; ?></textarea>
<br/><br/>
<input type="submit" name="submit" id="submit" value="Publish Blog Post">
<br/><br/>
</div>
<div class="blogClear"></div>
</form>
And here is the javascript I am using on the page to bring in the text editor and replace my textarea:
<script src="js/javascript-1.9.1.js" type="text/javascript"></script>
<script src="tiny_mce/jquery.tinymce.js"></script>
<script>
$().ready(function() {
$('textarea.tinymce').tinymce({
script_url : 'tiny_mce/tiny_mce.js',
theme : "advanced",
plugins : "autolink,lists,inlinepopups,paste,noneeditable,nonebreaking",
theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect",
theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_statusbar_location : "bottom",
theme_advanced_resizing : true,
});
});
</script>
As far as I can see by comparing my page with the example page they provide in the download there should be something showing uo! but All i am getting is a blank page as of now!
Many thanks in advance guys!
Phillip Dews
You could try to give a class to your textarea and add this to your tinymce config
mode:'exact',
elements : "your_textarea_class",
Related
Google Analytics collect data of Age & Gender by submiting form
Google Analytics provide a feature that can analyze "Age" & "Gender" of visitors. But my customer want to track these data by submiting a form after checkout successfully. That form looks as follow: <form id="form-checkout" class="form-success" method="post" action=""> <ol class="fs-fields"> <li class="gender"> <label><?php echo $this->__('Gender') ?></label> <div class="fs-radio-group fs-radio-custom clearfix fs-anim-lower"> <span><input type="radio" name="gender" value="Male" /><label><?php echo $this->__('Male')?></label></span> <span><input type="radio" name="gender" value="Female" /><label><?php echo $this->__('Female')?></label></span> </div> </li> <li class="ages"> <label><?php echo $this->__('Ages') ?></label> <select name="ages"> <option value="< 20"><?php echo $this->__('< 20') ?></option> <option value="20-35"><?php echo $this->__('20-35') ?></option> <option value="35-50"><?php echo $this->__('35-50') ?></option> <option value="> 50"><?php echo $this->__('> 50') ?></option> </select> </li> </ol> <div class="button-box"> <button class="fs-submit fs-show" type="button" title="<?php echo $this->__('submit') ?>" onclick="sendDataToUa();"><span><?php echo $this->__("Back to Home")?></span></button> <button class="fs-submit fs-show" type="button" title="<?php echo $this->__('Continue Shopping') ?>" onclick="window.location='<?php echo $this->getUrl() ?>'"><span><?php echo $this->__('Continue Shopping') ?></span></button> </div> </form> Js script: <script type="text/javascript"> function sendDataToUa(){ var gender = jQuery('input[name=gender]:checked', '#form-checkout').val(); var ages = jQuery('#form-checkout option:selected').val(); ga('set', 'dimension1', gender); ga('set', 'dimension2', ages); ga('send', 'pageview', { 'dimension1': gender, 'dimension2': ages, }); } </script> UPDATE: My tracking code look like: <script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics_debug.js','ga'); ga('create', 'UA-64495311-1','auto'); ga('require', 'displayfeatures'); ga('set', 'dimension1', 'male'); ga('set', 'dimension2', '< 20'); sendDataToUa(); ga('send', 'pageview', '/popupstore'); </script> I'm waiting for report data on google analytics.
The built-in Google feature imports data for recognized visitors from other Google Services (GDN mostly, I think), so this will not help you here (you cannot add demographic data yourself). You need to create custom dimensions in your property settings (session or user scope - hardly any visitor will change gender and age between hits) and send them along with an interaction hit. Implementation details depend on your setup so I just refer you to the documentation for custom dimensions and metrics, and then you may get back to us with any specific question that might come up.
Fancybox The requested content cannot be loaded
I'm using fancybox plugin for my image gallery and having really interested trouble. I have image gallery groups. On my first group, if i click hover link for to open first image. i'm getting an error like "The requested content cannot be loaded. Please try again later." But it works fine in other image groups. For example please check http://www.naplesoft.com/hotels/likya-residence-and-spa-and-the-likya-retreat/?tab=rooms Click view more info for Deluxe room, then click hover link "Click here to view more room images" You will get an error. But if you go other room types like "Deluxe room 106 or other ones" it works fine. I don't know what did i wrong? Here is PHP <?php if (count($room['room_images']) > 0 ) { ?> <p><a class="fancybox" rel="gallery<?php echo $counter; ?>" href="<?php echo $image['image']['sizes']['large']; ?>" title="<?php echo $image['caption']; ?>" >Click here</a> to view more room images</p> <div class="image"> <?php // $isFirst = true; foreach ($room['room_images'] as $image ) { // if (!$isFirst) { ?> <div class="foto"> <a class="fancybox" rel="gallery<?php echo $counter; ?>" href="<?php echo $image['image']['sizes']['large']; ?>" title="<?php echo $image['caption']; ?>" ><img style="width:150px; height:96px;" src="<?php echo $image['image']['sizes']['thumbnail']; ?>" alt="" /></a> </div> Any helps?
Magento Checkout Comment
i'm still a beginner at Magento and try to learn how to create Modules. Right now i'm working on a module, which allows the customer to add a comment during the checkout. Now i got a problem to implement the textarea, i created a new file called "practice" under app/design/frontend/base/default/layout and under app/design/frontend/base/default/template. I upload the new layout-file in the config.xml file of my module. But there isnt any textarea during the checkout, even though the right template is uploaded (i activated the template path hint option to see the path of each Block). app/code/local/Practice/CheckoutComments/etc/config.xml <frontend> <layout> <updates> <checkoutcomments> <file>practice/checkoutcomments.xml</file> </checkoutcomments> </updates> </layout> </frontend> Here is the code of the layout.xml file and the phtml.file i override: app/design/frontend/base/default/layout/practice/checkoutcomments.xml <?xml version="1.0" encoding="UTF-8"?> <layout> <checkout_onepage_review translate="label"> <reference name="checkout.onepage.agreements"> <action method="setTemplate"> <template>practice/checkoutcomments/onepage/comment-agreements.phtml </template> </action> </reference> </checkout_onepage_review> </layout> app/design/frontend/base/default/template/practice/checkoutcomments/onepage/comment-agreements.phtml <?php /** * * #see Mage_Checkout_Block_Agreements */ ?> <!-- Start of CheckoutComments module code --> <form action="" id="checkout-agreements" onsubmit="return false;"> <ol class="checkout-agreements"> <div> <br /> <label for="checkoutcomments"><?php echo Mage::helper('core')->__('Add your Comment for this Order') ?></label> <textarea name="checkoutcomments" id="checkoutcomments" style="width: 450px; height: 100px;"></textarea> </div> <!-- End of CheckoutComment module --> <?php if ($this->getAgreements()) : ?> <?php foreach ($this->getAgreements() as $_a): ?> <li> <div class="agreement-content" <?php echo ($_a->getContentHeight() ? ' style="height:' . $_a->getContentHeight() . '"' : '')?>> <?php if ($_a->getIsHtml()):?> <?php echo $_a->getContent()?> <?php else:?> <?php echo nl2br($this->escapeHtml($_a->getContent()))?> <?php endif; ?> </div> <p class="agree"> <input type="checkbox" id="agreement-<?php echo $_a->getId()?>" name="agreement[<?php echo $_a->getId()?>]" value="1" title="<?php echo $this->escapeHtml($_a->getCheckboxText()) ?>" class="checkbox" /><label for="agreement-<?php echo $_a->getId()?>"><?php echo $_a->getIsHtml() ? $_a->getCheckboxText() : $this->escapeHtml($_a->getCheckboxText()) ?></label> </p> </li> <?php endforeach ?> <?php endif; ?> </ol> </form> I deactivated my module and overrode the code of app/design/frontend/base/default/template/checkout/onepage/agreements.phtml with my customized pthml.file from above, then the textarea appears! I guess that something is wrong with my configurationsfiles, but i reference to the right block, since the block is uploaded but there isnt any textarea. I hope you can help me Regards
I solved the question by accident: In app/design/frontend/base/default/layout/practice/checkoutcomments.xml i changed the line <template>practice/checkoutcomments/onepage/comment-agreements.phtml </template> to: <template>practice/checkoutcomments/onepage/comment-agreements.phtml</template> it seems that i choose a wrong autoformat in eclipse, but i'm wondering, that this makes such a huge difference Regards
Form getting submitted even if submit button is disabled
I have a form where I have disabled the submit button. This button only gets enabled if I select a value of the dropdown. But I got a strange issue in IE and Chrome: if I press enter in the textbox, the form gets submitted (even though my submit button is disabled). Here is my code: <!DOCTYPE html> <html> <head> <title>Form Submit</title> </head> <body> <div> <form method="post" action="/distributor-locations-global/index.html?qa=Y" > <input type="hidden" value="" id="filter-url" name="filter_url"> <input type="hidden" value="SKF Distributor" id="filter_type" name="filter_type"> <input type="hidden" value="Y" id="filter_type" name="identifier"> <div class="field country-field full"> <select id="country" name="country" class="custom replaced" title="Sweden"> <option value="">Select location *</option> <option value="1042">Albania</option> <option value="1043">Algeria</option> <option value="1064">Benin</option> </select> </div> <div class="field zip-field full"> <input type="text" id="zip" name="zip" class="ui-disabled styled-text" > </div> <div class="button"><input type="submit" disabled="disabled" value="Show results" class="button styled-button"></div> </form> </div> </body> </html>
Submit button is not only way to submit the form, if you want to set some restrictions of form submit you have to use js function like this add onsubmit="return validate();" in your form tag e.g. <form method="post" action="/distributor-locations-global/index.html?qa=Y" onsubmit="return validate();"> add appropriate javascript function <script> function validate() { if (check_what_you_need_here==true) { return true; } return false; } </script> now each time form will be about to submit it will go to validate method, and only after it passes validation form will be send
you could disable the enter key on the form by using the below code in your header: <script type="text/javascript"> function stopRKey(evt) { var evt = (evt) ? evt : ((event) ? event : null); var node = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null); if ((evt.keyCode == 13) && (node.type=="text")) {return false;} } document.onkeypress = stopRKey; </script>
Contact page template - redirect to 'thank you page' not working
I'm trying to submit a form via custom page template but the problem is that it only works with form action="<?php the_permalink() ?>" and I need the form to be submitted and redirected to something like this form action="<?php bloginfo('url')?>/message-sent?id=<?php the_ID() ?>" Full code: <?php $emailError = ''; if(isset($_POST['submitted'])) { $email = trim($_POST['email']); //setup self email address $emailTo = $email; $subject = "[reminder] Don't forget to download " . get_the_title(); $body = "Name: $name \n\nEmail: $email \n\nComments: $comments"; $headers = 'From: Myemail reminders <no-reply#xyz.com>' . "\r\n"; wp_mail($emailTo, $subject, $body, $headers); $emailSent = true; } ?> <section class="box grid_9 list_posts"> <div class="inner"> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <div <?php post_class() ?> id="post-<?php the_ID(); ?>"> <div class="entry-content"> <div class="contact-form clearfix"> <?php if(isset($emailSent) && $emailSent == true) { ?> <div class="thanks"> <?php _e('Thanks, your email was sent successfully.', 'framework') ?> </div> <?php } else { ?> <?php the_content(); ?> <?php if(isset($hasError) || isset($captchaError)) { ?> <p class="error"><?php _e('Sorry, an error occured.', 'framework') ?> <?php } ?> <form action="<?php the_permalink()?>" id="contactForm" method="post"> <ul class="contactform"> <li> <input type="email" name="email" id="email" value="<?php if(isset($_POST['email'])) echo $_POST['email'];?>" class="required requiredField email" required="required" /> </li> <li class="buttons"> <input type="hidden" name="submitted" id="submitted" value="true" /> <input type="submit" value="Remind Me!"></input> </li> </ul></form> <?php } ?></div> </div> </div> <?php endwhile; else: ?> <div id="post-0" <?php post_class() ?>> <h1 class="entry-title"><?php _e('Error 404 - Not Found', 'framework') ?></h1> </div> <?php endif; ?></div> </section> I got no php errors in log, page is redirected successfully, but no email is sent. When using the_permalink, everything works just fine.
When submitting the form data to a different script, make sure the code for (validating the input and) sending the email is in that very file. Otherwise, your URL /message-sent might rewrite to a completely different script and the script with the above code isn't involved at all once the submit button gets clicked. Did that held you? Feel free, to ask, if my wording is incomprehensible or if my description isn't clear to you
Maybe you forgot to put ".php" at the end of your /message-sent?id=xxx file, i.e /message-sent.php?id=xxx? Another thought: It is always a good idea to filter the user input, because you will receive a lot of spam, put some sort of CAPTCHA validation code and sanitize/validate the whole user input text, i.e. every text, which comes from input fields of your form. For email: $email = filter_var($_POST['email'], FILTER_VALIDATE_EMAIL); For name and comments: $name = filter_var($_POST['name'], FILTER_SANITIZE_STRING); $comments = filter_var(strip_tags($_POST['comments']), FILTER_SANITIZE_STRING);