Jump to content

Need help with code


touchdez

Recommended Posts

I need someone to write a piece of code for this:

 

post-513637-0-73408800-1373121988_thumb.jpg

 

Explanation:

 

I want to upload a picture, choose which album to use, have a description and a file attached to the picture. I want to click on this picture on my website and download the file attached to it.

 

Is there anyone that can help me with this?

Link to comment
Share on other sites

I understand that, PSfever.com. I have written the piece of code that you see in the picture, by have no idea how to write the bit that does the database. That is the only bit of information that I am looking for.

 

Here is the code as it is at the moment:

 

/**
* Create table
*/
protected function createTable()
{
$sql1 = 'CREATE TABLE `'._DB_PREFIX_.'freebies` (
`id_image` int(10) unsigned NOT NULL auto_increment,
`id_album` int(2) NOT NULL,
`caption` varchar(256) NULL,
PRIMARY KEY (`id_image`))
ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8';

$sql2 = 'CREATE TABLE `'._DB_PREFIX_.'freebies_album` (
`id_album` int(10) unsigned NOT NULL auto_increment,
`title` varchar(256) NULL,
`short_description` text NULL,
`description` text NULL,
PRIMARY KEY (`id_album`))
ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8';

if( !Db::getInstance()->Execute($sql1) )
return false;

if( !Db::getInstance()->Execute($sql2) )
return false;

return true;
}

Edited by touchdez (see edit history)
Link to comment
Share on other sites

vekia, a while ago you helped me to do a CMS page with free designs, done in a table format, which works well, by the way.

 

I want to display these pictures on the Free Designs, but want to do it with a module instead of a CMS page. The module is the azgallery module, with some modifications. It will be easier to upload the designs this way, than to try and resize each picture manually to fit into the table - it looks better.

 

In hindsight, I want to be able to click on the name,not the picture.

Link to comment
Share on other sites

That is correct, Nemo1.

 

I have a page called Freebies on my website: http://touchdezines.com/shop/gallery

 

I would like this page to look the same as the Gallery page. At the moment I have it that a customer has to be logged in to get the free designs.

 

Which files do I need to post here?

Edited by touchdez (see edit history)
Link to comment
Share on other sites

I fixed it, Nemo1.

 

I am not sure if the Gallery is hooking to a CMS page - I don't think so, since I didn't create a page for it. The Freebies page is a CMS page, though.

 

I don't know what is going on with the Gallery now - it is there and then it is not. I will see whether I can fix it - sorry about that.

 

Got it!

Edited by touchdez (see edit history)
Link to comment
Share on other sites

okay

thanks

 

i checked it and it works

 

so my questions is, how you want to attach the file to each picture?

as far as i know there is no option for that, so you have to modify the module

and this is what you expect, right?

Link to comment
Share on other sites

That is right, vekia. I have already done some modifications to it and called the module something else, like freedesigns instead of azgallery, but I cannot get the zip file to attach to the picture, like I did in the CMS page called Freebies

Link to comment
Share on other sites

and what you think about additional field where you will put the url to the file that you will upload manually via FTP ? it's easier than huge modification of the module to support "uploading" and attaching files... just let me know what you think about that

Link to comment
Share on other sites

vekia, that is fine with me, as long as I can get the zip file attached to the picture or the name thereof. I don't like the CMS page I created, as I will have to keep creating pages, the more free designs I have. With the modified module it will not be the case.

 

Am I wrong in thinking it is just another line to be written to the table, the code which is in post #3 above?

Edited by touchdez (see edit history)
Link to comment
Share on other sites

well, it's necessary to create new field in the datbase you mentioned above.

I don't know how the full module code looks like, but i think that you should also change the object definition of course only when this module is based on it. If it isn't, you have to modify form to upload the picture + scripts to insert the "file url" field to the db

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...