Making blog By codeigniter - codeigniter
I am currently working on a codeigniter project, now i want a option "Blog" where user can post and comment. A post can contain images , tables, different fonts, similar case is for comments . I am novice in webdevelopment, only know php and it's one framework. Would you please anyone suggest me,what should i do ?
NEW:
After this post i got some good advice and i took decision to use rich text editor tiny_mce but my bad luck that again i am having problem . I can't include the tiny_mce or after including it's not working . I worked how they instructed but no change normal textarea is coming . What should i do?
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script src="<?php echo base_url("js/jquery-1.7.2.min.js"); ?>" type="text/javascript" ></script>
<script src="<?php echo base_url("js/scripts/tiny_mce/tiny_mce.js"); ?>" type="text/javascript" ></script>
<script type="text/javascript">
tinyMCE.init({
// General options
mode : "textareas",
theme : "advanced",
plugins : "pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,wordcount,advlist,autosave",
// Theme options
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,restoredraft",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_statusbar_location : "bottom",
theme_advanced_resizing : true,
// Example content CSS (should be your site CSS)
// content_css : "css/content.css",
// Drop lists for link/image/media/template dialogs
template_external_list_url : "lists/template_list.js",
external_link_list_url : "lists/link_list.js",
external_image_list_url : "lists/image_list.js",
media_external_list_url : "lists/media_list.js",
// Style formats
style_formats : [
{title : 'Bold text', inline : 'b'},
{title : 'Red text', inline : 'span', styles : {color : '#ff0000'}},
{title : 'Red header', block : 'h1', styles : {color : '#ff0000'}},
{title : 'Example 1', inline : 'span', classes : 'example1'},
{title : 'Example 2', inline : 'span', classes : 'example2'},
{title : 'Table styles'},
{title : 'Table row 1', selector : 'tr', classes : 'tablerow1'}
],
formats : {
alignleft : {selector : 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img', classes : 'left'},
aligncenter : {selector : 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img', classes : 'center'},
alignright : {selector : 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img', classes : 'right'},
alignfull : {selector : 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img', classes : 'full'},
bold : {inline : 'span', 'classes' : 'bold'},
italic : {inline : 'span', 'classes' : 'italic'},
underline : {inline : 'span', 'classes' : 'underline', exact : true},
strikethrough : {inline : 'del'}
},
// Replace values for the template plugin
template_replace_values : {
username : "Some User",
staffid : "991234"
}
});
</script>
</head>
<body>
<form method="post" action="somepage">
<div>
<div>
<textarea id="elm1" name="elm1" rows="15" cols="80" style="width: 80%"></textarea>
</div>
<br />
<input type="submit" name="save" value="Submit" />
<input type="reset" name="reset" value="Reset" />
</div>
</form>
</body>
</html>
Here is a basic blog tutorial and also check this one but you can use WordPress for blog with codeigniter and here is an answer on so about integrating WordPress with codeigniter.
About WordPress.
Hope it helps.
Related
Angular Meteor: MongoDB collections are not shown in the UI
I'm trying to use angular-meteor with Meteor and following the tutorial from https://www.meteor.com/tutorials/angular/collections I have the below code files: index.html <body ng-app="web-alerts"> <div ng-include="'client/index.ng.html'"></div> </body> client/index.ng.html <div ng-controller="AlertsListCtrl"> <h1>Tasks:</h1> <ul> <li ng-repeat="webAlert in tasks"> <b>{{webAlert.title}}</b> <p>Url: {{webAlert.url}}</p> <p>Emails: {{webAlert.emails}}</p> <p>Keywords: {{webAlert.keywords}}</p> <p>Frequency: {{webAlert.frequency}}</p> </li> </ul> </div> client/app.js Tasks = new Mongo.Collection("tasks"); if (Meteor.isClient) { angular.module('web-alerts', ['angular-meteor']); angular.module('web-alerts').controller('AlertsListCtrl', ['$scope', '$meteor', function($scope, $meteor) { $scope.tasks = $meteor.collection(Tasks); } ]); } In MongoDB, I have added some items to the collection. meteor:PRIMARY> db.tasks.find() { "_id" : ObjectId("55fe7cbc330d5b4cfb52ed9e"), "title" : "aaa yyy zzzz", "description" : "desc goes here", "url" : "http://abcd.com", "keywords" : "abcd, efgh, ijkl", "emails" : "", "frequency" : 10 } But I don't see the collection data in the UI. If I assign a static array to $scope.tasks in controller, it works fine. What could be the issue? Thanks in advance.
Solved it by moving client/app.js to the root folder. Can someone explain what could be the problem?
How to remove Dojo Dijit from Spring MVC project
How to remove Dojo Dijit from javascript call How can I change the following code to use just a html select we dont want to use dijit or dojo.. Can someone please help us out <script type="text/javascript"> Spring.addDecoration(new Spring.ElementDecoration({ elementId : "borough", widgetType : "dijit.form.Select", widgetAttrs : { promptMessage : "Enter Borough", required : true, onChange : function() { Spring.remoting.submitForm( 'submit', 'member', {_eventId: 'loadSchools', fragments:'contents'} ); return false; } }})); </script>
Delete the Dojo stuff and repace it with plain old pure Java Script: onchange='this.form.submit()': <form ...> <select name='someField' onchange='this.form.submit()'> <option>A</option> <option>B</option> <option>C</option> </select> </form>
Using Spring Webflow and Dijit it looks like I can only add one Decoration per element (field)?
Using Spring Webflow and Dijit it looks like I can only add one Decoration per element (field)? I am working on a Spring Webflow project and I was loading a list of schools once the user selects a Borough from a dropdown. The form was working great until I added a dijit.form.Select widgettype to it. Please look at the code below. Can I use both? The Issue I am having is on the Spring MVC side the bean now has the value "borough" in the borough field and NOT the value the user entered! <form:select path="borough" id="borough" > <form:option value="UNKNOWN" label="Unknown" /> <form:option value="X" label="Bronx" /> <form:option value="K" label="Brooklyn" /> <form:option value="M" label="Manhattan" /> <form:option value="Q" label="Queens" /> <form:option value="R" label="Staten Island" /> <form:option value="O" label="All Other Schools" /> </form:select> <script type="text/javascript"> Spring.addDecoration(new Spring.ElementDecoration({ elementId : "borough", widgetType : "dijit.form.Select", widgetAttrs : { promptMessage : "Enter Borough", required : true }})); Spring.addDecoration(new Spring.AjaxEventDecoration({ elementId: "borough", event: "onChange", formId:"member", params: {fragments:"body", _eventId: "loadSchools"}})); </script>
I fixed the issue. I removed the Spring.AjaxEventDecoration call and changed the Spring.ElementDecoration to the following: <script type="text/javascript"> Spring.addDecoration(new Spring.ElementDecoration({ elementId : "sex", widgetType : "dijit.form.Select", widgetAttrs : { promptMessage : "Enter Sex", required : true, onChange : function() { Spring.remoting.submitForm( 'submit', 'customer', {_eventId: 'sexchange', fragments:'contents'} ); return false; } }})); </script> I am not 100% clear on why the Ajax call did not work but I have my project working with this code now!
Fancybox 2 Title "Inside" on YouTube (iframe)?
Is it possible to put the title "inside" when using Fancybox 2 for YouTube/iFrame content? Anytime I try to insert title: { type: 'inside' } the video then plays in a new window at full screen. Here is what I'm currently using: <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js"></script> <link rel="stylesheet" href="lib/jquery.fancybox.css" type="text/css" media="screen" /> <script type="text/javascript" src="lib/jquery.fancybox.pack.js"></script> <script type="text/javascript"> $(document).ready(function() { $(".vids").fancybox({ maxWidth : 800, maxHeight : 600, fitToView : false, width : '60%', height : '60%', autoSize : false, closeClick : false, openEffect : 'none', closeEffect : 'none' }); }); </script> As a bonus, I would like the Title text to contain a link that opens _blank if it's possible. Also, perhaps related, to make videos play in all browsers, I have to alter the YouTube links, rather than doing something like: <a class="vids fancybox.iframe" href="http://www.youtube.com/watch?v=whatever"> I have to change it, and insert the word "embed", such as: <a class="vids fancybox.iframe" href="http://www.youtube.com/embed/whatever"> Is this a proper method? Thanks in advance.
Many question eh? First, to get the title inside the fancybox use the option helpers like helpers: { title : { type : 'inside' } } Second, to set a title with a link ... I would advice to you to set a data-* attribute in your anchor so the link won't show up in the normal browser's tooltip ... something like <a class="vids" href="http://www.youtube.com/watch?v=whatever" title="normal title" data-caption="open video Notice that I didn't add target="_blank" since clicking on the link will navigate automatically to the next page (and closing fancybox) Then use the callback beforeShow to construct the title beforeShow: function(){ this.title = this.title + " " + $(this.element).data("caption"); } Third, the proper way to display youtube videos is having a normal link (like in me second example above) and no more. Then include the fancybox-media js file in your document like <script type="text/javascript" src="lib/helpers/jquery.fancybox-media.js"></script> (check your own path) ... and use the helpers option to set the media like helpers : {media : {} } so, summarizing, your html should be something like <a class="vids" href="http://www.youtube.com/watch?v=whatever" title="normal title" data-caption="open video and your fancybox custom script like <script type="text/javascript"> $(document).ready(function() { $(".vids").fancybox({ maxWidth : 800, maxHeight : 600, fitToView : false, width : '60%', height : '60%', autoSize : false, closeClick : false, openEffect : 'none', closeEffect : 'none', helpers : { title : { type : 'inside' }, media : {} }, beforeShow: function(){ this.title = this.title + " " + $(this.element).data("caption"); } }); }); </script>
WYSIWYG editor for website with built-in syntax highlighting
I am looking for a WYSIWYG editor for my forum website. Which has inbuilt syntax highlighting like we have in www.stackoverflow.com or www.asp.net . So that I can save the whole text [entered by user] into the database and can render on the page with syntax highlighting. Please help. Don't take me wrong but I have already searched on google and Stackoverflow for this and I am not able to get the required answer. I would appreciate if it is an open source. :-)
I like and used tinymce editor, it's sample code something like following. <script src="/javascripts/tiny_mce/tiny_mce.js" type="text/javascript"></script> <script language="javascript" type="text/javascript"> tinyMCE.init({ mode : "textareas", theme : "advanced", plugins : "safari", convert_urls : false, width : "560", height : "15", // 'code' in 'theme_advanced_buttons1' is used for the HTML content theme_advanced_buttons1 : "fontselect,fontsizeselect, separator, bold,italic,underline,separator,forecolor,backcolor,code, justifyleft,justifycenter,justifyright,justifyfull", theme_advanced_buttons2 : "", theme_advanced_buttons3 : "", theme_advanced_toolbar_location : "top", theme_advanced_toolbar_align : "left", extended_valid_elements : "a[name|href|target|title|onclick],img[class|src| border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name], hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]" }); </script> <textarea cols="40" id="template_content" name="template[content]" rows="20"></textarea>