Click here to Skip to main content
15,441,434 members
Home / Discussions / Article Writing
   

Article Writing

 
PinnedFound plagiarism? Not sure if it is plagiarism? PinPopular
Sean Ewington30-Jul-15 5:25
editorSean Ewington30-Jul-15 5:25 
PinnedNote From Code Project - The Article Writing Forum PinPopular
Sean Ewington17-Jul-09 4:12
editorSean Ewington17-Jul-09 4:12 
QuestionA suggestion about the website Pin
forgetuu14-Sep-22 23:24
Memberforgetuu14-Sep-22 23:24 
AnswerRe: A suggestion about the website Pin
Richard MacCutchan15-Sep-22 0:26
mveRichard MacCutchan15-Sep-22 0:26 
QuestionUpdate article thumbnail with clearer picture but it does not show. Pin
Shao Voon Wong31-Aug-22 16:17
mvaShao Voon Wong31-Aug-22 16:17 
AnswerRe: Update article thumbnail with clearer picture but it does not show. Pin
Sean Ewington1-Sep-22 6:13
editorSean Ewington1-Sep-22 6:13 
QuestionThe way you edit images in articles seriously decreases the final quality of articles Pin
Mark Pelf 17-Aug-22 7:33
professionalMark Pelf 17-Aug-22 7:33 
AnswerRe: The way you edit images in articles seriously decreases the final quality of articles Pin
Sean Ewington17-Aug-22 7:58
editorSean Ewington17-Aug-22 7:58 
AnswerRe: The way you edit images in articles seriously decreases the final quality of articles Pin
Sean Ewington17-Aug-22 9:45
editorSean Ewington17-Aug-22 9:45 
AnswerRe: The way you edit images in articles seriously decreases the final quality of articles Pin
Sean Ewington17-Aug-22 12:48
editorSean Ewington17-Aug-22 12:48 
PraiseRe: The way you edit images in articles seriously decreases the final quality of articles Pin
Mark Pelf 17-Aug-22 19:23
professionalMark Pelf 17-Aug-22 19:23 
GeneralPosting an article without an email. Pin
Member 150787167-Aug-22 5:58
MemberMember 150787167-Aug-22 5:58 
GeneralRe: Posting an article without an email. Pin
PIEBALDconsult7-Aug-22 6:13
professionalPIEBALDconsult7-Aug-22 6:13 
AnswerRe: Posting an article without an email. Pin
Member 150787167-Aug-22 6:30
MemberMember 150787167-Aug-22 6:30 
GeneralRe: Posting an article without an email. Pin
PIEBALDconsult7-Aug-22 7:07
professionalPIEBALDconsult7-Aug-22 7:07 
GeneralRe: Posting an article without an email. Pin
Chris Maunder7-Aug-22 9:35
cofounderChris Maunder7-Aug-22 9:35 
GeneralRe: Posting an article without an email. Pin
Member 150787168-Aug-22 3:34
MemberMember 150787168-Aug-22 3:34 
QuestionHowto image clickable ? Pin
Patrice T31-Jul-22 20:51
mvePatrice T31-Jul-22 20:51 
AnswerRe: Howto image clickable ? Pin
Jo_vb.net2-Aug-22 12:57
MemberJo_vb.net2-Aug-22 12:57 
AnswerRe: Howto image clickable ? Pin
Sean Ewington8-Aug-22 3:49
editorSean Ewington8-Aug-22 3:49 
GeneralRe: Howto image clickable ? Pin
Patrice T8-Aug-22 5:16
mvePatrice T8-Aug-22 5:16 
Questioncode-igniter category wise article is not showing Pin
bharosewale29-Jul-22 10:42
Memberbharosewale29-Jul-22 10:42 
I have created a home page in codeigniter and have created a home controller in it. Index method has been created in the home controller, in which all articles have been shown. Now another function is added in the home controller in which to show all articles of single category, I also made model but in this show all articles in all categories. If I am calling only method then query is working but showing in home html page then all data showing all category.please help me



view page

<?php $this->load->view('front/header'); ?>
        <div class="container pt-4 pb-4">
    				<h3 class="pb-3">About Company</h3>
    				<p class="text-muted"> Nike clearly knows its audience and makes their mission obvious to them as soon as they land on the About Us page. There's no question that the visitor is in the right place and understands exactly what Nike has set out to do. </p>
    				<p class="text-muted"> Nike clearly knows its audience and makes their mission obvious to them as soon as they land on the About Us page. There's no question that the visitor is in the right place and understands exactly what Nike has set out to do. </p>
				</div>
				<!--computer category list-->
				<?php if(!empty($articles)){?>
					<?php $this->load->view('front/computer_category');?>
				<?php }?>


<!--yoga news start-->
<?php if(!empty($articles)){?>
				<div class="pb-4 pt-4">
					<div class="container">
				<div class="row gx-4">
					<div class="p-3 border bg-success text-white">
	        				<h3>योग</h3>
	        			</div>
        			</div>
        			<div class="row pb-3 pt-4">
        				<?php foreach ($articles as $article) {?>
	        		<div class="col-md-3">
	        			<div class="card">
	        			 		<?php if(file_exists('./public/uploads/articles/thumb_admin/'.$article['image'])){?>
	    <img src="<?php echo base_url('public/uploads/articles/thumb_admin/'.$article['image'])?>" class="card-img-top" alt="">

	        			 		<?php }?>
	    						<div class="card-body">
	        						
	        						<p class="card-text"><?php echo $article['title'];?></p>
	        						<a href="#" class="btn btn-primary">Go somewhere</a>
	    						</div>
								</div>
	        		</div><!--card 1-->
	        			<?php }?>
        	</div>
        	</div>
      	</div><!--latest blogs-->
      			<?php }?>


<!--yoga news end-->




<!--lifestyle news start-->
<?php $this->load->view('front/lifestyle');?>


<!--lifestyle news end-->


<!--technology news start-->
<?php if(!empty($articles)){?>
				<div class="pb-4 pt-4">
					<div class="container">
				<div class="row gx-4">
					<div class="p-3 border bg-success text-white">
	        				<h3>लाइफस्टाइल</h3>
	        			</div>
        			</div>
        			<div class="row pb-3 pt-4">
        				<?php foreach ($articles as $article) {?>
	        		<div class="col-md-3">
	        			<div class="card">
	        			 		<?php if(file_exists('./public/uploads/articles/thumb_admin/'.$article['image'])){?>
	    <img src="<?php echo base_url('public/uploads/articles/thumb_admin/'.$article['image'])?>" class="card-img-top" alt="">

	        			 		<?php }?>
	    						<div class="card-body">
	        						
	        						<p class="card-text"><?php echo $article['title'];?></p>
	        						<a href="#" class="btn btn-primary">Go somewhere</a>
	    						</div>
								</div>
	        		</div><!--card 1-->
	        			<?php }?>
        	</div>
        	</div>
      	</div><!--latest blogs-->
      			<?php }?>


<!--technology news end-->








				<div class="bg-light pb-4">
					<div class="container">
        	<h3 class="pb-3 pt-4">OUR SERVICES</h3>
        	<div class="row">
	        		<div class="col-md-3">
	        			<div class="card"> 
	    						<img src="<?php echo base_url('public/images/box1.jpg');?>" class="card-img-top" alt="">
	    						<div class="card-body">
	        						<h5 class="card-title">Website Development</h5>
	        						<p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
	        						<a href="#" class="btn btn-primary">Go somewhere</a>
	    						</div>
								</div>
	        		</div><!--card 1-->

	        		<div class="col-md-3">
	        			<div class="card"> 
	    						<img src="<?php echo base_url('public/images/box2.jpg');?>" class="card-img-top" alt="">
	    						<div class="card-body">
	        						<h5 class="card-title">Website Development</h5>
	        						<p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
	        						<a href="#" class="btn btn-primary">Go somewhere</a>
	    						</div>
								</div>
	        		</div><!--card 1-->

	        		<div class="col-md-3">
	        			<div class="card"> 
	    						<img src="<?php echo base_url('public/images/box3.jpg');?>" class="card-img-top" alt="">
	    						<div class="card-body">
	        						<h5 class="card-title">Website Development</h5>
	        						<p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
	        						<a href="#" class="btn btn-primary">Go somewhere</a>
	    						</div>
								</div>
	        		</div><!--card 1-->

	        		<div class="col-md-3">
	        			<div class="card"> 
	    						<img src="<?php echo base_url('public/images/box4.jpg');?>" class="card-img-top" alt="">
	    						<div class="card-body">
	        						<h5 class="card-title">Website Development</h5>
	        						<p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
	        						<a href="#" class="btn btn-primary">Go somewhere</a>
	    						</div>
								</div>
	        		</div><!--card 1-->
        	</div>
        </div>
				</div><!--our services-->

				<?php if(!empty($articles)){?>
				<div class="pb-4 pt-4">
					<div class="container">
        			<h3 class="pb-3 pt-4">LATEST BLOGS</h3>
        				
        			<div class="row">
        				<?php foreach ($articles as $article) {?>
	        		<div class="col-md-3">
	        			<div class="card">
	        			 		<?php if(file_exists('./public/uploads/articles/thumb_admin/'.$article['image'])){?>
	    <img src="<?php echo base_url('public/uploads/articles/thumb_admin/'.$article['image'])?>" class="card-img-top" alt="">

	        			 		<?php }?>
	    						<div class="card-body">
	        						
	        						<p class="card-text"><?php echo $article['title'];?></p>
	        						<a href="#" class="btn btn-primary">Go somewhere</a>
	    						</div>
								</div>
	        		</div><!--card 1-->
	        			<?php }?>
	        		
        	</div>
        	</div>
      	</div><!--latest blogs-->
      			<?php }?>

      	<?php $this->load->view('front/footer'); ?>






Home controller page

<?php 
class Home extends CI_Controller{
	function index(){
		$this->load->model('Article_model');
		$param['offset']=4;
		$param['limit']=0;
		$articles=$this->Article_model->getArticlesFront($param);
		//echo "<pre>";
		//print_r($articles);
		//echo "
";
//exit;
$data['articles']=$articles;
$this->load->view('front/home',$data);

}



function computerCategory($category_id=43){

$this->load->model('Category_model');
$this->load->model('Article_model');
$this->load->helper('text');
$this->load->library('pagination');

$param['offset']=4;
$param['limit']=0;

$category=$this->Category_model->getCategory($category_id);


$articles=$this->Article_model->getComputerArticlesFront($param);

$data=[];


$data['articles']=$articles;

$data['category']=$category;

//$data['pagination_links']=$pagination_links;

#$this->load->view('front/blog',$data);
$this->load->view('front/computer_category',$data);
}



//function computerCategory(){
//$this->load->model('Category_model');
//$this->load->model('Article_model');
//$param['offset']=4;
//$param['limit']=0;
//$articles=$this->Article_model->getComputerArticlesFront($param);
//$data=[];
//$data['articles']=$articles;

//$this->load->view('front/computer_category',$data);
//echo "
";
		//print_r($articles);
		//echo "
";
//exit;
//}



//function lifestyleCategory(){
//$this->load->model('Article_model');
//$param['offset']=4;
//$param['limit']=0;
//$articles=$this->Article_model->getlifestyleArticlesFront($param);
//$data['articles']=$articles;
//$this->load->view('front/computer_category',$data);
//echo "
";
		//print_r($articles);
		//echo "
";
//exit;
//}

function lifestyleCategory($category_id=42){

$this->load->model('Category_model');
$this->load->model('Article_model');
$this->load->helper('text');
$this->load->library('pagination');

$param['offset']=4;
$param['limit']=0;

$category=$this->Category_model->getCategory($category_id);


$articles=$this->Article_model->getlifestyleArticlesFront($param);

$data=[];


$data['articles']=$articles;

$data['category']=$category;

//$data['pagination_links']=$pagination_links;

#$this->load->view('front/blog',$data);
$this->load->view('front/computer_category',$data);
}
}
?>


Article model
<?php  


class Article_model extends CI_Model{
	
	function getArticle($id){
			$this->db->select('articles.*,categories.name as category_name');
		 	$this->db->where('articles.id',$id);

		 	$this->db->join('categories','categories.id=articles.category','left');
		 	$query=$this->db->get('articles');

		 	$article=$query->row_array();
		 	return $article;


	}

	function getArticles($param= array()){
		$query = $this->db->get('articles');
		if(isset($param['offset']) && isset($param['limit'])){
			$this->db->limit($param['offset'],$param['limit']);
		}

		if(isset($param['q'])){
			$this->db->or_like('title',trim($param['q']));
			$this->db->or_like('author',trim($param['q']));
		}
		

		$query = $this->db->get('articles');
		#echo $this->db->last_query();

		$articles = $query->result_array();
		return $articles;
	}
	
    
    function getArticlesCount($param= array()){// this function is use for count total article
    	 if(isset($param['q'])){
			$this->db->or_like('title',trim($param['q']));
			$this->db->or_like('author',trim($param['q']));
		}

		if(isset($param['category_id'])){
			$this->db->where('category',$param['category_id']);
		}
		$count=$this->db->count_all_results('articles');
		return $count;
	}

	function addArticle($formArray){
		$this->db->insert('articles',$formArray);
		return $this->db->insert_id();
	}

	function updateArticle($id,$formArray){
		$this->db->where('id',$id);
		$this->db->update('articles',$formArray);
		
	}

	function deleteArticle($id){
		$this->db->where('id',$id);
		$this->db->delete('articles');
		
	}

	/*front methods*/
	function getArticlesFront($param= array()){
		//$query = $this->db->get('articles');
		if(isset($param['offset']) && isset($param['limit'])){
			$this->db->limit($param['offset'],$param['limit']);
		}

		if(isset($param['q'])){
			$this->db->or_like('title',trim($param['q']));
			$this->db->or_like('author',trim($param['q']));
		}

		if(isset($param['category_id'])){
			$this->db->where('category',$param['category_id']);
		}

		$this->db->select('articles.*,categories.name as category_name');

		$this->db->where('articles.status',1);
		
		$this->db->order_by('articles.created_at','DESC');


		$this->db->join('categories','categories.id=articles.category','left');

		$query = $this->db->get('articles');
		#echo $this->db->last_query();

		$articles = $query->result_array();
		//echo $this->db->last_query();

		return $articles;
	}



	/*front computer category methods*/
	function getComputerArticlesFront($param= array()){
		
		if(isset($param['offset']) && isset($param['limit'])){
			$this->db->limit($param['offset'],$param['limit']);
		}

		if(isset($param['q'])){
			$this->db->or_like('title',trim($param['q']));
			$this->db->or_like('author',trim($param['q']));
		}

		if(isset($param['category_id'])){
			$this->db->where('category',$param['category_id']);
		}

		$this->db->select('articles.*');

		$this->db->where('articles.category',43);
		
		$this->db->order_by('articles.created_at','DESC');


		//$this->db->join('categories','categories.id=articles.category','left');
		$query = $this->db->get('articles');

		$articles = $query->result_array();

		return $articles;
	}
	



	/*front lifestyle category methods*/
	function getlifestyleArticlesFront($param= array()){
		//$query = $this->db->get('articles');
		if(isset($param['offset']) && isset($param['limit'])){
			$this->db->limit($param['offset'],$param['limit']);
		}

		if(isset($param['q'])){
			$this->db->or_like('title',trim($param['q']));
			$this->db->or_like('author',trim($param['q']));
		}

		if(isset($param['category_id'])){
			$this->db->where('category',$param['category_id']);
		}

		$this->db->select('articles.*,categories.name as category_name');

		$this->db->where('articles.category',42);
		
		$this->db->order_by('articles.created_at','DESC');


		$this->db->join('categories','categories.id=articles.category','left');

		$query = $this->db->get('articles');
		//echo $this->db->last_query();

		$articles = $query->result_array();
		//echo $this->db->last_query();

		return $articles;
	}
}
?>


computer_category view page

<!--computer news start-->
<?php if(!empty($articles)){?>
				<div class="pb-4 pt-4">
					<div class="container">
				<div class="row gx-4">
					<div class="p-3 border bg-success text-white">
	        				<h3>कंप्यूटर</h3>
	        			</div>
        			</div>
        			<div class="row pb-3 pt-4">
        				<?php foreach ($articles as $article) {?>
	        		<div class="col-md-3">
	        			<div class="card">
	        			 		<?php if(file_exists('./public/uploads/articles/thumb_admin/'.$article['image'])){?>
	    <img src="<?php echo base_url('public/uploads/articles/thumb_admin/'.$article['image'])?>" class="card-img-top" alt="">

	        			 		<?php }?>
	    						<div class="card-body">
	        						
	        						<p class="card-text"><?php echo $article['title'];?></p>
	        						<a href="#" class="btn btn-primary">Go somewhere</a>
	    						</div>
								</div>
	        		</div><!--card 1-->
	        			<?php }?>
        	</div>
        	</div>
      	</div><!--latest blogs-->
      			<?php }?>


<!--computer news end-->

<!--lifestyle start-->
<?php if(!empty($articles)){?>
				<div class="pb-4 pt-4">
					<div class="container">
				<div class="row gx-4">
					<div class="p-3 border bg-success text-white">
	        				<h3>lifestyle</h3>
	        			</div>
        			</div>
        			<div class="row pb-3 pt-4">
        				<?php foreach ($articles as $article) {?>
	        		<div class="col-md-3">
	        			<div class="card">
	        			 		<?php if(file_exists('./public/uploads/articles/thumb_admin/'.$article['image'])){?>
	    <img src="<?php echo base_url('public/uploads/articles/thumb_admin/'.$article['image'])?>" class="card-img-top" alt="">

	        			 		<?php }?>
	    						<div class="card-body">
	        						
	        						<p class="card-text"><?php echo $article['title'];?></p>
	        						<a href="#" class="btn btn-primary">Go somewhere</a>
	    						</div>
								</div>
	        		</div><!--card 1-->
	        			<?php }?>
        	</div>
        	</div>
      	</div><!--latest blogs-->
      			<?php }?>

AnswerRe: code-igniter category wise article is not showing Pin
Richard Deeming1-Aug-22 0:34
mveRichard Deeming1-Aug-22 0:34 
QuestionHow to check submitted article status Pin
Member 1569523525-Jul-22 4:25
professionalMember 1569523525-Jul-22 4:25 
AnswerRe: How to check submitted article status Pin
Greg Utas25-Jul-22 4:59
mveGreg Utas25-Jul-22 4:59 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.