Everything posted by donkeyfourthumbs
-
Using Galleria to display images from a JSON Feed
Afternoon, Have installed GalleryCMS and all is working fine. But I have no idea how to display the uploaded images in Galleria from a JSON feed? Anybody able to help? Cheers in advance D4T
-
Trouble with navigation!
Morning, Found the problem, it was just a little mistake in one of the javascript files. Thanks for the help. Regards Donkeyfourthumbs
-
Trouble with navigation!
OK I am really confused now!! When the link to the following file (code) is in, the drop downs work, but the Home button doesn't (function($){ $.randomImage = { defaults: { //you can change these defaults to your own preferences. path: './images/', //change this to the path of your images myImages: ['random_1.jpg', 'random_2.jpg', 'random_3.jpg', 'random_4.jpg' ] //put image names in this bracket. ex: 'harold.jpg', 'maude.jpg', 'etc' } } $.fn.extend({ randomImage:function(config) { var config = $.extend({}, $.randomImage.defaults, config); return this.each(function() { var imageNames = config.myImages; //get size of array, randomize a number from this // use this number as the array index var imageNamesSize = imageNames.length; var lotteryNumber = Math.floor(Math.random()*imageNamesSize); var winnerImage = imageNames[lotteryNumber]; var fullPath = config.path + winnerImage; //put this image into DOM at class of randomImage // alt tag will be image filename. $(this).attr( { src: fullPath, alt: winnerImage }); }); } }); })(jQuery); This code has nothing to do with the drop downs! But when it's not there, the drop downs don't and the Home button does
-
Trouble with navigation!
Yeah that was a mistake, but just fixed that and still doesn't work?
-
Trouble with navigation!
Thanks for the reply, will look into it. Cheers
-
Trouble with navigation!
Morning, having some trouble with a link on a website I am currently trying to build. Can't for the life of me, figure out what I have done wrong. Here is a link to a page that has the trouble: http://www.library.gg/dev/content.php?id=21 Index page works, but once inside the website, you can no longer get back to the index page using the navigation. Any ideas? Regards Donkeyfourthumbs
-
CKEditor
Afternoon, Anyone tried CKEditor yet? If so, how is the following meant to be now with CKEditor <form method="post" action=""> <?php include("config.php"); if (isset($_POST["submit"])) { $txt = $_POST['txt']; $txt = mysql_real_escape_string($_POST['txt']); $result = mysql_query("UPDATE content SET txt='$txt' WHERE id='1'", $db); if ($result) { echo "<meta http-equiv=Refresh content=0;url=index.php>"; } } else { $result = mysql_query("SELECT * from content WHERE id='1'", $db); while ($row=mysql_fetch_assoc($result)){ require('fckeditor/fckeditor.php'); $oFCKeditor = new FCKeditor('txt'); $oFCKeditor->BasePath = 'fckeditor/'; $oFCKeditor->Value = $row['txt']; $oFCKeditor->Height = '400'; $oFCKeditor->Create(); } } ?> <br /><br /> <input type="submit" name="submit" value="Update Page"/> </form> Anybody help? Cheers DFT
-
FCKEditor
Thanks Sam G, but I know how to remove items and amend the toolbar, just not how to get rid of it. Istables, It's because it's just a small text box, don't want anything fancy, CSS styles the area. Maybe I should look at TinyMCE for this instead? DFT
-
FCKEditor
Evening, Anybody, any ideas? DFT
-
FCKEditor
Morning, Anybody know how to get rid of the toolbar completely from FCKEditor. I know how to add or remove items, but can't figure out how to remove it completely! Any ideas DFT
-
PHP, check if field value already exists
Perfect, works like a dream. $qry = "SELECT * FROM table_name WHERE active='1' LIMIT 1; the above just needed an " after LIMIT 1, but apart from that, does what I need it to do. Thanks for your help. DFT
-
PHP, check if field value already exists
It needs to do both thinking about it. If the record being submitted is active and a record already inserted is active, then it needs to return with an error. If the record being submitted is false then it should insert even if a record already submitted is true. Even I'm getting confused!!! Does the above make sense? DFT
-
PHP, check if field value already exists
Once again, thanks MrBrightside, it does work and does do what I asked for, but i just thought of something! For example, if the database has the following 2 records. Company1 Contact1 "Some Nice Words" 'active=1' Company2 Contact2 "Very Nice Words" 'active=0' If i want to add a new record, I want it to check the 'active' value I am submitting. If it is 0 then the record can be added, if it is 1 then I want to return a message. At the moment, if any of the records return 1, then it won't Insert. Does that make sense? Donkeyfourthumbs
-
PHP, check if field value already exists
Thank you MrBrightside. Too much time in front of a computer today, will try first thing tomorrow, but it does make sense and looks like it will work. Thanks Donkeyfourthumbs
-
PHP, check if field value already exists
Evening everyone, I wonder if someone can help. My database has records with 4 fields, one named 'active'. How do I add a record, that first checks the database to see if any of the fields named 'active' have a value of '1' and if it does, does not insert the record, but if none of the records have a value of '1' it will insert it. Does any of the above make sense? If so, can anybody help? Thanks Donkeyfourthumbs
-
Notice: Undefined variable:
Morning Spike, Thanks again. Works fine now. DFT
-
Notice: Undefined variable:
Morning, I am getting the following error message: Notice: Undefined variable: result in /Applications/MAMP/htdocs/website.com/admin/index.php on line 71 Here is my PHP code: <?php include("config.php"); if (isset($_POST["submit"])) { $txt = $_POST['txt']; $txt = mysql_real_escape_string($_POST['txt']); $result = mysql_query("UPDATE content SET txt='$txt' WHERE id='1'", $db); } if ($result) { echo "<meta http-equiv=Refresh content=0;url=index.php>"; } else { $result = mysql_query("SELECT * from content WHERE id='1'", $db); while ($row=mysql_fetch_assoc($result)){ require('fckeditor/fckeditor.php'); $oFCKeditor = new FCKeditor('txt'); $oFCKeditor->BasePath = 'fckeditor/'; $oFCKeditor->Value = $row['txt']; $oFCKeditor->Height = '300'; $oFCKeditor->Create(); } } ?> Line 71 is the following: if ($result) { any ideas, what I've done wrong? Cheers DFT
-
Header problem with MAMP
Cheers Spike, Your a star. Have a good day. DFT
-
Header problem with MAMP
Thanks Spike, I do understand now. if ($result) { header("Location: " . $_SERVER['php_SELF']); } Am I actually doing this right? Would there be a better way of doing this? Once the user has updated the text in the text editor, and hits 'Update Page' all I want is for the page to refresh. I used to use this: echo "<meta http-equiv=Refresh content=0;url=index.php>"; What is best practice? Thanks
-
Header problem with MAMP
Thanks for the reply, No here is the complete code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Alderney Commission for Renewable Energy</title> <style type="text/css"> @import url("reset.css"); </style> <link href="style.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="wrapper"> <?php include("inc_top.php"); ?> <div id="hero" class="home_hero"></div> <div id="hero_bottom" class="with_sub"></div> <div id="content"> <div id="left_column"> <div id="left_nav"> <ul> <li><a href="link.php">TIDE AND WAVE RESOURCE </a> </li> <li class="no_border"><a href="link.php">BLOCK MAPS </a> </li> </ul> </div> <div id="news"> <h6>LATEST NEWS</h6> <div id="news_holder"> <div class="news_item"> <span class="date">1st March 2009</span> <p>New Alderney Commission for Renewable Energy website goes live. <a href="link.php">read more</a></p> </div> <div class="news_item"> <span class="date">22nd July 2008</span> <p>The Renewable Energy (Aldeney) Law, 2007 receives Royal Assent. <a href="link.php">read more</a></p> </div> <div class="news_item"> <span class="date">June 2008</span> <p>Application for Consent received from Alderney Renewable Energy Limited (ARE) and OpenHydro Limited for the deployment of up to four turbines in the Alderney Race, together with subsea and onshore cabling. <a href="link.php">read more</a></p> </div> <a href="link.php" class="cta_view_all">View all news items.</a> </div> </div> </div> <div id="main_column"> <h1 class="header_home">About Alderney</h1> <p> <form method="post" action=""> <?php include("config.php"); if (isset($_POST["submit"])) { $txt = $_POST['txt']; $txt = mysql_real_escape_string($_POST['txt']); $result = mysql_query("UPDATE content SET txt='$txt' WHERE id='1'", $db); } if ($result) { header("Location: " . $_SERVER['php_SELF']); } else { $result = mysql_query("SELECT * from content WHERE id='1'", $db); while ($row=mysql_fetch_assoc($result)){ require('fckeditor/fckeditor.php'); $oFCKeditor = new FCKeditor('txt'); $oFCKeditor->BasePath = 'fckeditor/'; $oFCKeditor->Value = $row['txt']; $oFCKeditor->Height = '300'; $oFCKeditor->Create(); } } ?> <br /><br /> <input type="submit" name="submit" value="Update Page"/> </form> </p> </div> <div class="clearing">Content for class "clearing" Goes Here</div> <?php include("inc_footer.php"); ?> </div> </div> </body> </html>
-
Header problem with MAMP
Morning Everyone, I am having a little trouble with PHP and Header Location. I know this has been covered in other topics, but I don't really understand what the problem is and how it is fixed. Here is my code: <form method="post" action=""> <?php include("config.php"); if (isset($_POST["submit"])) { $txt = $_POST['txt']; $txt = mysql_real_escape_string($_POST['txt']); $result = mysql_query("UPDATE content SET txt='$txt' WHERE id='1'", $db); } if ($result) { header("Location: " . $_SERVER['php_SELF']); } else { $result = mysql_query("SELECT * from content WHERE id='1'", $db); while ($row=mysql_fetch_assoc($result)){ require('fckeditor/fckeditor.php'); $oFCKeditor = new FCKeditor('txt'); $oFCKeditor->BasePath = 'fckeditor/'; $oFCKeditor->Value = $row['txt']; $oFCKeditor->Height = '300'; $oFCKeditor->Create(); } } ?> <br /><br /> <input type="submit" name="submit" value="Update Page"/> </form> And here are my errors: Notice: Undefined index: php_SELF in /Applications/MAMP/htdocs/website.com/admin/index.php on line 72 Warning: Cannot modify header information - headers already sent by (output started at /Applications/MAMP/htdocs/website.com/admin/index.php:6) in /Applications/MAMP/htdocs/website.com/admin/index.php on line 72 As you can see I am working in MAMP, is it just because it is in MAMP or would I get the same problem on an online server? Thanks in advance for anyones assistance.
-
FCKEditor
Morning, I have managed to get the browser window working with the following code I have found: <html> <head> <script type="text/javascript"> function showimg(){ var input=document.createElement('input'); input.id="image"; input.style.width='400px'; var f=function(){ window.SetUrl=function(value){ document.getElementById('image').value=value; } var filemanager='/dev/admin/fckeditor/editor/filemanager/browser/default/browser.html?Connector=connectors/php/connector.php&Type=File'; var connector='connectors/php/connector.php'; window.open(filemanager,'fileupload','modal,width=600,height=400'); } input.onclick=f; document.body.appendChild(input); } </script> </head> <body onload="showimg()"> click the input box<br /> </body> </html> But it is throwing up the following error: The server didn't reply with a proper XML data. Please check your configuration. Any ideas on how I can get this to work? I just don't want to have 2 different ways on my site of uploading files. Thanks Donkeyfourthumbs
-
FCKEditor
Evening, Is it possible to use FCKeditor as a standalone file picker? And if so, how do you do it? Donkeyfourthumbs
-
Website Search
Connetu_C Thanks again for your advice. Not sure why I was using page_no, so the new table is as follows: id, page_title, page_url, txt And for the most part I have some code that does what I need it to. After a user makes a search it forwards to the results.php page that includes this code: <?php include("search.php"); ?> and here is the code from search.php <?php $var = @$_GET['q']; $trimmed = trim($var); $limit=10; if ($trimmed == "") { echo '<p>'."Please enter a search..."."</p>"; exit; } if (!isset($var)) { echo '<p>'."We dont seem to have a search parameter!"."</p>"; exit; } include("config.php"); $query = "select * from content where txt like \"%$trimmed%\" order BY id asc"; $numresults=mysql_query($query); $numrows=mysql_num_rows($numresults); if ($numrows == 0) { echo '<p>'."Sorry, your search terms "" . $trimmed . "" returned zero results"."</p>"; echo "<p><a href=\"http://www.google.com/search?q=" . $trimmed . "\" target=\"_blank\" title=\"Look up " . $trimmed . " on Google\">Click here</a> to try the search on Google</p>"; } if (empty($s)) { $s=0; } $query .= " limit $s,$limit"; $result = mysql_query($query) or die("Couldn't execute query"); echo "<p>You searched for: "" . $var . ""</p>"; echo '<p>'."References to your search term can be found on the following pages:"."</p>"; $count = 1 + $s; while ($row= mysql_fetch_array($result)) { $title = '<a href='.$row['page_url'] . ' target="_self">' .$row['page_name'] . '</a>'; echo '<p>'."$count.) $title".'</p>'; $count++; } $currPage = (($s/$limit) + 1); if ($s>=1) { $prevs=($s-$limit); echo '<p>'." <a href=\"$PHP_SELF?s=$prevs&q=$var\"><< Prev 10</a>  ".'</p>'; } $pages=intval($numrows/$limit); if ($numrows%$limit) { $pages++; } if (!((($s+$limit)/$limit)==$pages) && $pages!=1) { $news=$s+$limit; echo '<p>'." <a href=\"$PHP_SELF?s=$news&q=$var\">Next 10 >>".'</a></p>'; } $a = $s + ($limit); if ($a > $numrows) { $a = $numrows; } $b = $s + 1; echo '<p>'."Showing results $b to $a of $numrows".'</p>'; ?> Like I said, this is all I really need the search to do and is fine apart from a couple of things. If a user enters a blank search the exit; statement stops the results.php page from showing the bottom of the page? And if there are more than 10 records (this is the limit I have set) the link to the next results isn't quite right? Can you help? Cheers Donkeyfourthumbs
-
Website Search
Morning, I am looking to add a basic website search to a site and wondered if PHP was the way to go? I am thinking about creating a database called 'content' with the following fields: id, page_no, page_title, txt So records could be as follows: 1, 1, 'home', 'some welcome text would go here' 2, 2, 'contact', 'some contact text would go here' 3, 3, 'information', 'information about what we do' Hopefully you get the idea? The search would need to be of every txt column in every row Firstly is PHP the way to go? secondly, how do you do it? and how do you return the results? If someone could help Many thanks Donkeyfourthumbs