Jump to content

howard-moore

Members
  • Posts

    41
  • Joined

  • Last visited

Everything posted by howard-moore

  1. Thanks for the heads-up for this. Unfortunately my server host is telling me that they are no longer going to allow the downgrade to older versions (only 5.4), so I guess I have a busy few weeks ahead!!
  2. Thanks, but I have absolutely no idea what to do with extract? I appreciate that I will need to rewrite the code, and I have instructed someone to do that for me for the next build of the core code that I use, but in the meantime unfortunately it will take far, far too long to change all the other sites running it (there are hundreds of them!). Is there not something I can change in the php.ini file to allow this to work?
  3. OK, so I've done some testing with another site and tried turning off register_globals, and this brings up exactly the same results. Therefore, this is what is causing the problem. Does anyone know how to replicate what register_globals does when running 5.4.12? I can't begin to tell you how many months of work it will be to recode everything if it can't be done!!! Thanks (in hope!), Neil
  4. Actually, I've just noticed another one using the new PHP 5.4.12 version, which I am sure is related. I have the following code: <? include ("content/content_news$template.php"); ?> and the idea is when you are www.domain.com/news.php?template=2 it would show ../content/content_news2.php. However, it is ignoring this and just showing template #1. This is clearly the same issue that I am having above, and I have hundreds of sites that I would need to recode if I can't find a fix to get this working under 5.4.12. Any ideas? Thanks, Neil
  5. OK - I've looked through the code at ../docs/index.php and it is using $_GET['dir'].
  6. This is really interesting, but I'm not sure I completely understand. I'm afraid I don't really know much about register_globals, and what needs to be changed. Could you explain what this does? Thanks so much for your help!
  7. Thanks for the reply. However, the include part is now working - the only bit that doesn't work now is the urlencode($dir) part. The way this works in 4.4.9 is that when a user clicks on a particular directory (e.g. ../docs/index.php?dir=Sub Folder) the include shows the contents of that sub-folder through the page that the user is on (e.g. ../documents.php). I could go back and recode everything so that the code at ../docs/index.php is all in documents.php, but I have hundreds of sites all using the same process, and it will take days and days of recoding to get it all done this way.
  8. OK thanks. However, does anyone know why the urlencode element works in PHP 4.4.9 and not 5.4.12? I have the include part working, but not the dynamic bit on the end: <?php include ("$domain/docs/index.php?dir=".urlencode($dir)); ?>
  9. I have managed to change the php.ini file so that allow_url_include is now on, but the ?dir=".urlencode($dir) part is still not working. It is only showing the first directory. The idea of the code is that when you click through to a sub-directory, the url will be something like: domain/documents.php?dir=Sub Folder&order_by=date&order=asc It would then show the contents of the Sub Folder. It works fine in php 4.4.9, so I don't know what the include should look like now. Do you know if anything else in the php.ini needs to be changed to allow that, or do I need to change include ("$domain/docs/index.php?dir=".urlencode($dir));?
  10. $domain is just my website domain (to save typing it out again and again), and $dir is the directory that the script at docs/index.php is looking at. When you click into a the directory it lists other directories or files that are in there.
  11. OK, so I have managed to get some of it to work by using the following: <?php echo (file_get_contents("$domain/docs/index.php?dir=".urlencode($dir))); ?> However, the purpose of dir=".urlencode($dir) is that it is meant to display the directory that you have clicked on, but file_get_contents does not do this in the same way as include. Any thoughts?
  12. Hi All, I have recently upgraded my PHP server version to 5.4.12, and I am having some real difficulties with getting something to work. The issue is with includes. I have a folder/file display script which I need to include into a pretty standard PHP page, and in 4.x it worked fine <?php include ("$domain/docs/index.php?dir=".urlencode($dir)); ?> However, I cannot get anything in that directory (/docs) to show at all. When I roll back the server version to 4.x it works, but in 5.4.12 it doesn't. I have read through the changes in PHP4-5, but cannot find anything about this. Can someone recommend a change that would enable it to work? Thanks, Neil
  13. Sorry - missed some typing in the above post. Basically I am trying to repeat the above code twice on the same web-page, and it is only allowing me to show it the once. Any ideas?
  14. Apologies to all if I am being completely thick which works fine when running on a page on its own, but when I try to repeat the script further down the page, it doesn't show at all. Basically, it appears only to show once on a page, and I cannot make it appear more than once. Can anyone help me with this? <? $result=mysql_query("SELECT id, title, link, parent_code, page_order, menu_title, parent_title, page_type, live, editable, installed FROM PCNET_$filename WHERE type='PAGE' AND installed='checked' AND page_order!='x' ORDER BY parent_code, ABS(page_order), title"); $menu = array( 'items' => array(), 'parents' => array() ); while ($items = mysql_fetch_assoc($result)) { $menu['items'][$items['id']] = $items; $menu['parents'][$items['parent_code']][] = $items['id']; } function buildMenu($parent_code, $menu) { $html = ""; if (isset($menu['parents'][$parent_code])) { $html .= "\n"; foreach ($menu['parents'][$parent_code] as $itemId) { if(!isset($menu['parents'][$itemId])) { $html .= "<tr><td class=\"".$menu['items'][$itemId]['page_type']."_EDIT\"><ul class=\"edit clear\"><li><a href=\"admin_pages_".$menu['items'][$itemId]['page_type'].".php?eid=".$menu['items'][$itemId]['id']."\">Edit / Delete<span></span></a></li></ul></td> <td class=\"".$menu['items'][$itemId]['page_type']."_b_c\">".$menu['items'][$itemId]['page_order']."</td> <td class=\"".$menu['items'][$itemId]['page_type']."_b_l\">".$menu['items'][$itemId]['menu_title']."</td> <td class=\"".$menu['items'][$itemId]['page_type']."_b_l\">".$menu['items'][$itemId]['parent_title']."</td> <td class=\"".$menu['items'][$itemId]['page_type']."_b_c\"><img src=\"../data/admin_docs_".$menu['items'][$itemId]['live'].".gif\" title=\"Showing Page\"></td></tr>"; } $html .= "</tr> \n"; if(isset($menu['parents'][$itemId])) { $html .= "<tr><td class=\"".$menu['items'][$itemId]['page_type']."_EDIT\"><ul class=\"edit clear\"><li><a href=\"admin_pages_".$menu['items'][$itemId]['page_type'].".php?eid=".$menu['items'][$itemId]['id']."\">Edit / Delete<span></span></a></li></ul></td> <td class=\"".$menu['items'][$itemId]['page_type']."_b_c\">".$menu['items'][$itemId]['page_order']."</td> <td class=\"".$menu['items'][$itemId]['page_type']."_b_l\">".$menu['items'][$itemId]['menu_title']."</td> <td class=\"".$menu['items'][$itemId]['page_type']."_b_l\">".$menu['items'][$itemId]['parent_title']."</td> <td class=\"".$menu['items'][$itemId]['page_type']."_b_c\"><img src=\"../data/admin_docs_".$menu['items'][$itemId]['live'].".gif\" title=\"Showing Page\"></td></tr>"; $html .= buildMenu($itemId, $menu); } } $html .= "\n"; } return $html; } echo buildMenu(0, $menu); ?> Thanks - Neil
  15. Hi, I have put together the following script which creates a dynamic drop-menu (in unordered list which is subsequently styled in CSS). What I am looking to do is find a way to add a focus to show the menu tab in a different colour when that page has been selected. Currently the below PHP is called on each page of the website. It is done like this to have top-level pages (parent pages) and sub-pages, and is ordered by a page order (both top-level and sub-page). All the pages on the website has a unique field called 'code', and in the past I have used class="there" in the unordered list item when that code has been selected, but I really don't know how I can do it with the below code: <?php $result=mysql_query("SELECT id, title, link, parent_code, page_order, menu_title, parent_live, parent_title, page_type, live, FROM PCNET_$filename WHERE type='PAGE' AND live='checked' ORDER BY parent_code, page_order, title"); $menu = array( 'items' => array(), 'parents' => array() ); while ($items = mysql_fetch_assoc($result)) { $menu['items'][$items['id']] = $items; $menu['parents'][$items['parent_code']][] = $items['id']; } function buildMenu($parent_code, $menu) { $html = ""; if (isset($menu['parents'][$parent_code])) { $html .= "\n"; foreach ($menu['parents'][$parent_code] as $itemId) { if(!isset($menu['parents'][$itemId])) { $html .= "<li><a href=\"".$menu['items'][$itemId]['link']."?eid=".$menu['items'][$itemId]['id']."\">".$menu['items'][$itemId]['menu_title']."</a></li>"; } $html .= "\n"; if(isset($menu['parents'][$itemId])) { $html .= "<li><a href=\"".$menu['items'][$itemId]['link']."?eid=".$menu['items'][$itemId]['id']."\">".$menu['items'][$itemId]['menu_title']."</a><ul>"; $html .= buildMenu($itemId, $menu); } } $html .= "</ul></a></li> \n"; } return $html; } echo buildMenu(0, $menu); ?> This is what I have used in the past (when the above menu code was static, and not the new dynamic version) to show when a page has been selected: <li<?php if ($code == 'local-info') echo ' class="there"'; ?>> If anyone has any suggestions how I can get the class="there" into the above when you are on a particular page I would really appreciate the feedback - been tearing my hair out over this one for days! Thanks, Neil
  16. dcro2 - you are a complete legend. That is what I was trying to do all along! Thank you so, so much!
  17. That's kind of where I am struggling. I thought that if I added it to the URL it would mean that when it was clicked (thus calling the data through the council-indiv.php page) it would show that button with the different css class (class="subthere"). However, I can see that I am wrong, as it simply colours all buttons with that class. Any other ideas how to get a menu 'selected' button to work?
  18. Hmm... didn't seem to work. Perhaps if I give a bit more detail about how the page set-up works: I have a page called council-indiv.php which is the template for the content stored in the MySQL database. The problem with the code that I have found is that if I add a particular string to the URL (such as 'focus=here') it returns ALL the list items that make up the dynamic menu as containing focus=here. Therefore, they all show the css style for a menu item that is selected. Really scratching my head here!
  19. Hi All - an update! I have added a bit more code to create 'if' / 'else' depending on whether the particular menu list item (i.e. link) has been clicked. This then sets the menu list item to have a specific 'class' attributed to it, which is then coloured a specific colour by the CSS. However, the issue I have is that the particular element I have added (&focus=here), when added to the end of the URL, simply colours all the link button as 'here' buttons: <!-- ##### START LIST_INFO_PAGES ##### --> <?php include("../config/config.php"); ?> <?php $sql = "SELECT * FROM `PCNET_$filename` WHERE parent = 'council' AND type = 'Pages' ORDER BY page_order ASC"; $sql_result = mysql_query ($sql, $connection ) or die ('request "Could not execute SQL query" '.$sql); while ($row = mysql_fetch_assoc($sql_result)) { print ''; if ($row["status"]<>'') { echo '<li><a href="../council-indiv.php?id='; echo ($row["id"]).'&name='; echo nl2br(stripslashes(utf8_decode($row["category"]))).'&focus=here" title="'; echo nl2br(stripslashes(utf8_decode($row["title"]))).'"'; if ($focus = here) { echo ' class="subthere">'; } else { echo '>'; } echo nl2br(stripslashes(utf8_decode($row["category"]))).'</a></li>'; }; }; ?> <!-- ##### END LIST_INFO_PAGES ##### --> Any help would be gratefully received. Neil
  20. Hi All, I have a snippet of code (below) which I use to create a dynamic menu from a MySQL database for a community website. Fields used in the database are: ID parent (what the parent page is) page_order (what is says on the tin) short_title (a short title for the page for the URL) title (the page title - used as the text for the link) content (the content for the page) I have got the dynamic list to display fine, but what I would like to be able to do is give each list item a 'class' tag when it has been selected (and thus is the page being shown). Can anyone suggest how to amend the below code to allow this? Code is: <!-- ##### START LIST_INFO_PAGES ##### --> <?php include("../config/config.php"); ?> <?php $sql = "SELECT * FROM `PCNET_$filename` WHERE parent = 'council' ORDER BY page_order ASC"; $sql_result = mysql_query ($sql, $connection ) or die ('request "Could not execute SQL query" '.$sql); while ($row = mysql_fetch_assoc($sql_result)) { print ''; if ($row["status"]<>'') { echo '<li><a href="../council-indiv.php?id='; echo ($row["id"]).'&short_title='; echo nl2br(stripslashes(utf8_decode($row["short_title"]))).'" title='; echo nl2br(stripslashes(utf8_decode($row["title"]))).'>'; echo nl2br(stripslashes(utf8_decode($row["title"]))).'</a></li>'; }; }; ?> <!-- ##### END LIST_INFO_PAGES ##### --> Help will be welcome! Neil
  21. I've had a look at both of these, and frankly they are a little beyond me. Does anyone know of a relatively simple download/unzip/upload/add php include solution?
  22. Hi All, I want to be able to show selected pages of my website as PDF using a 'PDF' button much like this site does: http://www.westmeon.org.uk/index.php?option=com_content&task=blogsection&id=8&Itemid=35 I presume that I will need to install some sort of software on my server (which runs the latest PHP, MySQL etc.) but after hours of searching online I cannot find a simple way of doing this. Does anyone have any suggestions or pointers for how I can do this? FYI my website is written in PHP drawing data from a MySQL database. Regards, Neil
  23. Hi All, I have some data stored in a MySQL database and each row has a StartDate in yyyy-mm-dd format. I need to do up two different forms: 1. A drop menu where they can select to show all the entries for a particular year. 2. A submit button where they can show all entries that are in the future. I know how to show these results using a static query string, but don't know how to get them to show using a form. Hope someone can help! Regards, Neil
  24. Hi All, I have a snippet of PHP code that I use to call results from a MySQL database with dates, categories and descriptions. I have added two new fields to the MySQL table called 'agenda' and 'minutes'. These two fields contain a path to a file, but not all the entries will have the field completed. What I want to know is how I need to edit my code so that it shows the path to the file if it is present, but displays nothing if it is not present. The complicating factor is that I also want the code to return the requirements for a hyperlink if the field has been populated: e.g. <a href="../meetings/agendas/$agenda">+ download</a>, but return nothing at all, or better still something saying that there is nothing to download if the field has not been populated. The script I have done so far is: <?php include("MeetingsConfig.php"); include("../config/config.php"); $daysAhead = 60; ?> <?php $sql = "SELECT * FROM `PC_$filename` WHERE startDate between '".date("Y-m-d")."' AND '".date("Y-m-d",mktime(0, 0, 0, date("m"), date("d")+$daysAhead, date("Y")))."' AND type = 'Meeting' ORDER BY startDate ASC"; $sql_result = mysql_query ($sql, $connection ) or die ('request "Could not execute SQL query" '.$sql); while ($row = mysql_fetch_assoc($sql_result)) { if ($row["description"]<>'') { echo '<table class="calendar_list"><tr><td class="calendar_list_date_'; echo nl2br(stripslashes(utf8_decode($row["type"]))).'">'; echo date("F j, Y",strtotime($row["startDate"])).' ยป <strong>'; echo nl2br(stripslashes(utf8_decode($row["type"]))).'</strong></td></tr>'; echo '<tr><td class="calendar_list_description">'; echo nl2br(stripslashes(html_entity_decode($row["description"]))).'<br /><br /><table><tr><td>'; }; }; ?> Hope someone can help! Rgds, Neil
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.