Sublime directory Surf the web anonymous Pagerank Monitor


When calling a Mysql DB field that is empty display a image

juraphotos
Wed 29 October 2008, 03:13 pm GMT +0100
Hiya
Just got a little daft problem and my brain has went a bit dead {totaly)

I am creating a simple content management syistem that can be managed and edited directly from the admins pc
without having to use the  pages online admin pages on the remote server
using MS access or open office however i did run into a few minor probs with open office

To get round the oppen office probs I am creating some scripts so that I can manage my remote
website from my local server, All apears to be working just about ok

The test site can be found here its a simple image gallery based on the script but can easly adapted for classifides, blog etc
that can be remotaly managed

http://juraphotos.photofxr.co.uk/gallery/
______________________________________________________
If their is no image name stored in the DB table I would like to display a small logo


The image name  is stored in the database
and is called to the page with
$query_rs_page_template = "SELECT * FROM webpages WHERE number = '$page_id'";

<img src="../images/<?php echo $row_rs_page_template['urlmainimg']; ?>.jpg" />

A simple if and else statement but as they say I carnt see the wood for the trees lol
any sergestions would be most apreciated
___________________________________________
The script is to be  opensource [b][/b]
To do docs and clean up the junk
I shall upload the full script later tonight or tomorow to my server with a few notes
Many thanks
Juraphotos

Nikolas
Wed 29 October 2008, 03:17 pm GMT +0100
I am not sure if this is what you ask but I will give it a try :)

<img src="../images/<?php echo empty($row_rs_page_template['urlmainimg']) ? 'imageDoesNotExists.gif' : $row_rs_page_template['urlmainimg']; ?>.jpg" />
?>

olaf
Wed 29 October 2008, 07:23 pm GMT +0100
a better way is to test the image url with file_exists and if not show the default image

Nikolas
Wed 29 October 2008, 07:29 pm GMT +0100
a better way is to test the image url with file_exists and if not show the default image

You are right that's better because it prevents you from bad inserted data too.

olaf
Wed 29 October 2008, 07:32 pm GMT +0100
or a missing / bad image

juraphotos
Wed 29 October 2008, 10:58 pm GMT +0100
Thanks for the help I have just being looking on php.net at the

if (file_exists( ))

should do the job fine, I should have thought of that must have being looking at code to long and brain got waterloged thanks

Also out of intrest which WYSIWYG editor you use on this forum
I am at pressent using the fckeditor on the remote admin server and the portable remote admin server on the usb stik

I was wondering if you had any recomendations for a WYSIWYG editor that did not use much resorces
The fckeditor is very good but can be a little slow to load

Many thanks
Juraphotos
Much apreciated

Nikolas
Wed 29 October 2008, 11:16 pm GMT +0100
fckeditor is just fine. Here we are not using a WYSIWYG editor. Forum editors use BBcode not native html so it wont help you anyway

olaf
Thu 30 October 2008, 06:44 am GMT +0100
forget fuckeditor and use tinymce, all bigger CMS systems using tinymce. fckeditor creates terrible html code

juraphotos
Fri 31 October 2008, 12:35 pm GMT +0100
Thanks for the advice Lastnight I setup tinymce all is working fine The fck editor worked fine just slow
but will take your advice on the messy code also i noticed tinymce was nice and easy intergrate into the
pages

I am going to have a look at the tinymce  php compressor to see if it can speed up loading
The final scripts are almost done just have to check things through, and tidyup the code and get rid of the junk

Many Thanks much apreciated

Juraphotos

olaf
Fri 31 October 2008, 01:10 pm GMT +0100
I guess you like this tutorial
http://www.web-development-blog.com/archives/upload-images-for-usage-in-tinymce/

juraphotos
Thu 6 November 2008, 02:33 am GMT +0100
Thanks for the link to the tutorial tinymce was easy to setup without any problems nice and easy I have also intergrated ibrowser and imanager
The link to the download page for ibrowser and imanager is

http://j-cons.com/downloads/

it might be usefull to other users as they are a free alternative to tinymce,s MCFileManager and MCImageManager

The cms is coming along fine I am adding some security to the admin pages,

though the cms syistem is intended to be managed remotly using Ms access or using the scripts i have made that run from a server running on a local pc or the portable server on the usb stik

I thought id better add this incase any users of the script have problems conecting directly to their remote mysql database from their pc and have to edit their site via their web browser

Also have to do some basic template examples,  documents and setup instructions
Many thanks for your help and i will keep you updated

Juraphotos

andr103
Thu 27 November 2008, 06:27 pm GMT +0100
I am not sure if this is what you ask but I will give it a try :)

<img src="../images/<?php echo empty($row_rs_page_template['urlmainimg']) ? 'imageDoesNotExists.gif' : $row_rs_page_template['urlmainimg']; ?>.jpg" />
?>


Thanks a lot. It's very useful for me

Archive for SMF v1.00 by N.P. Valid XHTML 1.0 Transitional