View Full Version : select page background color
I've been struggling to make an optional field in the admin template to set the page background color on a post basis. I've made another column in the pixelpost table, called color, added a field with a variable named color to the admin template and added this variable into the mysql statement that adds all the other vars to the db on sumbit. Blah...nothing. I can enter anything but nothing is stored in the db. Can somebody please give me the code for this feature? Thanks.
my website : http://glimpse.zeeblo.com/pblog (http://glimpse.zeeblo.com/pblog)
this is the code for the field:
<div id='jcaption'>Background Color (of this format 12345 {!do not put # sign}) </div>
<div id='content'><input type="text" name="color" style="width:45%;" /><br /><br /></div>
this is for the insertion in the db
$image = $filnamn;
if($status == "ok") {
$query = "insert into ".$pixelpost_db_prefix."pixelpost(id,datetime,headline,body,image,category ,color)
VALUES('NULL','$datetime','$headline','$body','$im age','','$color')";
$result = mysql_query($query) || die("Error: ".mysql_error());
I'm curious as to how to get this working as well.
@jagX: make from it downloadable mod and add it to pixelpost page (registering before as developer).
@GeoS: I don't think you got me, I'm not a php/mysql code, and I'm addressing to you guys for help because I can't do it. I'll gladly make the mod and everything, if I know HOW.:D
jasonspix
10-06-2005, 10:41 PM
I managed to get something like this working on my site. Not sure if you are still trying to get it to work, but I put instructions and the modified files on pixelpost's site. http://www.pixelpost.org/v1/index.php?x=downloads&details=119
Hope it helps.
I can't thank you enough for your help Jason. This works great.
cheers
blinking8s
10-10-2005, 12:41 PM
thats the coolest hack EVER!
skennedy1217
10-17-2005, 06:33 PM
I almost implemented this. What held me back is that I want the option of white, grey, dark grey and black backgrounds. For the first two colors I need black navigation hyperlinks. For the darker background I need white or light grey navigation links.
I suppose what I am looking for is the ability to set the style sheet for each post and not just the background. I have a style switcher already (running a modified version of Jasonpix's template). The default them is dark grey, and I suppose I could instruct people in the comments/info on which background I think is best, but what would be cool is to have it predetermined for each post and remove the user's ability to change it.
Joe[y]
10-17-2005, 06:53 PM
I almost implemented this. What held me back is that I want the option of white, grey, dark grey and black backgrounds. For the first two colors I need black navigation hyperlinks. For the darker background I need white or light grey navigation links.
I suppose what I am looking for is the ability to set the style sheet for each post and not just the background. I have a style switcher already (running a modified version of Jasonpix's template). The default them is dark grey, and I suppose I could instruct people in the comments/info on which background I think is best, but what would be cool is to have it predetermined for each post and remove the user's ability to change it.
this should work on the same principle - but rather defining a stylesheet in the databse rather than just a hex code.
skennedy1217
10-17-2005, 07:01 PM
Cool, I'll have to give that a try!
skennedy1217
10-18-2005, 03:23 AM
Okay, I looked at it and it doesn't seem too daunting, but I need to ask some questions first before I attempt it. I have no formal PHP training, but have dabbled enough to be dangerous.
1) Would I just change every reference in the two index files from 'BGcolor' to whatever I wanted to use for the new field in the pixelpost_pixelpost table (e.g., "SSheet")? Anything else?
2) Would the following line in image_template.php be correct?
<link href="templates/jasonspix/<SSheet>" rel="stylesheet" type="text/css" />
3) Then everytime I made a post I would enter something like "lightgrey.css" into the extra field on the post new image page?
It feel like I'm missing something.
Joe[y]
10-18-2005, 04:35 PM
you'd also need the table in your database to be linked with SSheet i guess. i haven't actually downloaded this mod so i can't look at the script itself but it seems you have the right idea.. play around!
skennedy1217
10-21-2005, 02:59 AM
Rather than try to find all of Jasonspix's changes in the two index files, I just kept them "as is" and created the required BGColor field in the pixelpost_pixelpost row of my database. I did set the default value to "dark.css", which I consider my standard stylesheet. That way my old posts weren't left without a stylesheet.
Then I just replaced my stylesheet link in the metatag area with this:
<link href="templates/jasonspix/<IMAGE_BACKGROUND>" rel="stylesheet" type="text/css"/>
I did make a change to the index.php file in the \admin\ folder, so that the title of the form field was switched from "Background" to "Stylesheet." I also added a parenthetical note listing my four stylesheet names. Here is a screenshot (http://www.chromaticus.net/blog/wp-content/screenshots/stylesheethack.jpg).
Maybe someday I'll go back and change the code on the two index.php files (e.g., renaming BGColor to whatever), but I'm wondering if this could be handled as a plugin instead? For example, my WordPress plugins create buttons, tabs and fields in my WordPress admin template. Is capability like that possible with PixelPost, or at least planned for in the future?
Joe[y]
10-21-2005, 10:31 AM
admin addons are currently in the cvs development version. i'm going to play around a bit and see if it will work like you ask it to - because i agree - this is a must have at some point in the future. recently we had one user complaining about having to transfer his mods over to each new version of pp which i sympathised with... as there are still limitations to addons.
i'll definetely try and get the ball rolling amongst the dev team about this.
Joe[y]
04-20-2006, 03:20 PM
i'm thinking of working on an admin addon for this. would be fun for a template idea i have.
me and admin addons = chaos. should be fun!
Fellow Eskimo
04-21-2006, 11:41 PM
There is also a way you can change your background to any color, not just 4 shades of grey. The hack is in the forum...ex: http://www.felloweskimo.net/photo and they change with each entry. Though, its a bit more involved then the stylesheet one.
eyefloater
04-22-2006, 02:50 AM
']i'm thinking of working on an admin addon for this. would be fun for a template idea i have.
me and admin addons = chaos. should be fun!
Yes! Please do put some effort into this. It's exactly what I've been trying (and failing) to develop for my own photoblog. It would also serve as a great teaching example for when I put together another add-on I'd like to use (admin css layout selector).
- eyefloater
jiveking
04-24-2006, 06:17 AM
eyefloater I'll share what I did. I modified the "Simple" template and from the admin panel (screenshot (http://www.lucentphotos.com/templates/AdminPanel.gif)) you can choose a different background color for each picture and set the color of the border around the picture as well. (You will have to use the colors Hex Code of course - FF0000)
Here's a link to the zip file (http://www.lucentphotos.com/templates/simple-jiveking.zip) with a word doc that contains pics of the admin/index.php modified code, the modified "Simple" template, and a copy of the admin/index.php. Basically just add the lines of code like you see in the pic and add the two field to the MySQL database you created.
I'm no PHP/Coder guru but it works and if you have questions I'll try to answer them.
Oh, and this is based on ver. 1.4.2!
Connie
04-24-2006, 08:58 AM
Please take care that any hacks are not guaranteed to survive program updates!
so hacking something into 1.5-scripts what was designed for PP 1.4.2 must not work...
please try to write Addons to add this functionality...
support for hacks is not possible and as every human being has weak memory, hacks are forgotten and after updates a lot of problems arise
and we developers feel weak, guilty and ashamed for new unknown problems ;=)
do you really want this? Do you want the developers run into these psychic problems ????
so please no more hacks, please! Only addons with clear instructions for which PP version the addon is working and tested ;=):rolleyes:
raminia
04-24-2006, 02:28 PM
I've made an admin-addon for it. It needs Pixelpost 1.5RC1. (it might work with 1.5Beta)
http://forum.pixelpost.org/showthread.php?p=28527#post28527
eyefloater
04-24-2006, 09:05 PM
*blinks* 3 responses? Niiice.
jiveking/connie/ramina ... thanks very much for your input. This is great, now I've got multiple sources of info to learn from. And don't worry connie, while I'll use jiveking's example to learn whatever I can, I'll make sure to go the admin add-on route and not cause any future headaches for the PP developers. ;)
- eyefloater
vBulletin® v3.7.3, Copyright ©2000-2013, Jelsoft Enterprises Ltd.