• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Programming CMS for pic gallery

#1
[eluser]davy_yg[/eluser]

Hello all,

I wonder how to program CI CMS for picture gallery, any suggestion ?

#2
[eluser]noideawhattotypehere[/eluser]
Your question is kinda unclear, what kind of gallery is it? What for? Where will you use it?

I store all my pictures in folder ./gallery/, while uploading i create a 100x100 thumb and add a db record. My gallery db table is: id - filename - thumbname - category. Hope this will be helpful.

#3
[eluser]davy_yg[/eluser]

I basically do not know how to write the codes. Especially how you upload picture from computer and store it to certain folder. Also, how to write the codes to make them appears on the sites with CodeIgniter.

#4
[eluser]noideawhattotypehere[/eluser]
If you dont know the basics dont start doing CMs, read user-guide, find out about upload library. When you find out how-to, then simply
Controller:
Code:
foreach($pictures as $pic)
{
$data['html'] .= '<img src="'.$pic['thumbname'].'">';
}
$this->load->view('gallery', $data);
View:
Code:
&lt;?php echo $html; ?&gt;

Find out the rest how to style etc by yourself.

#5
[eluser]davy_yg[/eluser]

controllers/upload.php

Code:
class Upload extends CI_Controller {

function gallery_show()
{
  foreach($pictures as $pic)
  {
  $data['html'] .= '<img src="'uploads/.$pic['thumbname'].'">';
  }

$this->load->view('gallery');  
}

}

I point to the url to : http://localhost/CodeIgniter_214/index.php/upload/gallery_show

Parse error: syntax error, unexpected 'uploads' (T_STRING) in C:\xampp\htdocs\CodeIgniter_214\application\controllers\upload.php on line 44

line 44: $data['html'] .= '<img src="'uploads/.$pic['thumbname'].'">';

Why is it?

I store all the pictures that I uploaded to: CodeIgniter_214/uploads/

#6
[eluser]noideawhattotypehere[/eluser]
First of all: learn basic php, you keep coming to forums with your problems coming out of lack of knowledge. Dont throw yourself at frameworks without AT LEAST basic php understanding/skills
Second: get some real IDE like netbeans, so it highlights code for you and tells where and what kid of error you have in your syntax.
Third:
Code:
$data['html'] .= '<img src="uploads/'.$pic['thumbname'].'">';
You could also wrap it into "" without concatenation escaping whichever " you want.

#7
[eluser]davy_yg[/eluser]

I know basic php. I just installed netbeans and still trying to figure out how to use it. I currently use Notepad++

I try - debug - debug file - run arguments(empty) -> (x) Php interpreter must be selected. How to select Php interpreter ?


I receive this error messages:

----------------------------------------------
A PHP Error was encountered

Severity: Notice

Message: Undefined variable: pictures

Filename: controllers/upload.php

Line Number: 42

-------------------------------------------------
A PHP Error was encountered

Severity: Warning

Message: Invalid argument supplied for foreach()

Filename: controllers/upload.php

Line Number: 42

-------------------------------------------------
A PHP Error was encountered

Severity: Notice

Message: Undefined variable: html

Filename: core/Loader.php(829) : eval()'d code

Line Number: 2

#8
[eluser]noideawhattotypehere[/eluser]
So you know basic php but you cant read error messages?
Debug? Seriously... Press F6 or Run > Run project, and you are good to go.
$this->load->view('gallery'); to $this->load->view('gallery', $data);
Find out the rest on your own, you have given an error message + line which is causing it.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.