Jump to content
xisto Community

vujsa

Members
  • Content Count

    1,008
  • Joined

  • Last visited

Everything posted by vujsa

  1. Well since this post has been revived, I guess I'll add a resource. Mambo Hut has a large selection of templates availible and has multiple ways to preview the templates. Keep in mind the most Mambo / Joomla templates can be used without any problems on any version of both Mambo and Joomla. This is due to the fact that Mambo / Joomla templates are mostly HTML and very basic PHP. Since templates for Mambo and Joomla are so simple in nature, I recommend that anyone with a little PHP knowledge and HTML knowledge attempt to create their own template. The hardest part is getting all of the CSS file together and graphics work designed. Here is my custom template in progress: VW One. What do you think? Hope this helps future readers. vujsa
  2. Your tutorial site is comming along very well. I like that your content is the how to and source code for the page being displayed. Sorry that I beat you to the punch. I've been wanting to do a proper follow-up on the original topic for a while now but didn't have the time before. I do think that your tutorials do a very good job of taking my articles to the next level. You tend to give the practicle application side of the story. It is good to see that my information has inspired others to learn PHP or at tackle a larger project for the first time. While I'm sure I'll get a little side tracked on the topic from time to time as I answer questions, I think I am still on the path that I want to be on for this series of topics. The real focus of this series of articles is to show just how little PHP can be used to get major benefits. I think that so far I used about 40 lines of actual PHP code and about the same for HTML. The hardest part for me is trying to remain general enough in my examples to allow my readers to see alternate uses for the scripts. I learned all of my PHP knowledge from adapting and/or combining various scripts to get what I want. [/hr] Well, I chose to use the flat file database because I still think it is a very valuable system to learn from. Before mySQL was availible and all of the other database systems were expensive and/or difficult to use, we all used the flat file database. The down side of it was if you got a lot of data in your database combined with a lot of traffic on your site, the server got bogged down frequently. Imagine thousands of people all trying to search your database with thousands of records at the same time. Needless to say, MySQL runs much faster than the old system but if you don't have a lot of data to store, then you might want to consider using the flat file system. A good example of this would be a counter. If you don't already use a MySQL database, it would be silly to set one up just for a one entry, one field counter. Even if you wanted to have a counter for every page, the database would remain very very small. I highly recommend that everyone interested in learning PHP take interest in using the file system functions for PHP. Being able to manipulate your files will offer you many more possibilities in the end. As for your image gallery project, I think I can offer some help. Have you read my article about image gallery creation? Creating Your Own Image Gallery With Php. It isn't a source availible tutorial like this one and the type of gallery is different but many of the same functions are used that you will need. It was written for people that have large image directories to be able to learn how to display their images to others so it is based on a different viewpoint than your question. It looks at the directory and begins by checking to see if the images have thumbnails already. If the thumbnail exists, the thumbnail is displayed. If the thumbnail does not exist, then one is created and then it is displayed. This is better in most cases than creating a thumbnail every time an index of images is shown since that would overload the server easily. If you want to have 50% and or 75% sized images, it may be better to generate them on-the-fly or only upon request since saving the extra images can eat up a lot of storage space but the images wouldn't be requested narly as ofter as the thumbnails would be. The best idea for you I think is to generate a thumbnail right after the image is uploaded. You should still check to be sure that you have a thumbnail for each image when you display your index and create the thumbnail if missing but that should be a failsafe system. In order to display a certain number of images on a page and provide a link to the next page with the next images, you need to keep track of which image was shown last on this page and provide that information to the next page either through the url or a form. You will display your images using a loop that you will need to stop when the correct number of images are shown on the page. You can card code the number or allow your user to specify the number to show. Also, if you want to show 15 images, you probably want to have 3 rows of 5 images. If this is the case, then you'll need a secondary loop that will control the number of rows used. For example if $x controlls the total images and $y controls the number of images in a row: $x = 1;$y = 1;if ($x <= 15){ if ($y<=5) { // INSERT IMAGE HERE $y++; } else { $y = 1; // INSERT NEW ROW HERE // INSERT IMAGE HERE $y++; } $x++;}That will only show 15 images. Be sure to add a condition to check and see if there is an image to show. You don't want an error message if you only have 14 images in your directory! Well that's all for now. I'll add more to the topic later but now it's time for bed. Hope this helps. vujsa
  3. In order to set up a tree menu system in Mambo or Joomla, you just need to add the new item and set the Parent Item accordingly. If the item already exists, you need only to edit the menu item and select a Parent Item for it. This is controlled under the menu heading at the top of the Admin Control Panel. Click Menu --> Menu Name --> Add to add a new item ????[/tab]OR[tab]Click Menu --> Menu Name --> Menu Item to edit an existing item. [/hr] You can control the orientation of the menu and which pages it will appear on in the modules heading at the top of the Admin Control Panel. Find your menu in the modules section and click on it to edit it. There will be an option for Menu Style where you can select a vertical, horizontal, or flat list menu. Much of the overall menu appearence is determined by the template used and any modifications made to the CSS file. Hope this helps. vujsa
  4. This topic is a follow up to CMS101 - Content Management System Design and PHP Tutorial: Menu Or Sidebar Script For CMS101 [hr=teal] [/hr] Overview: [/hr] Now that we have discussed the basic concepts of a CMS written in PHP, we should begin to think about ways to make those concepts more useful and more powerful. Basically, using only what we have discussed so far, your website would still need a file for each and every page you wanted to display to your users. What we will discuss now a method of only creating one template file and a script that will automatically change the content of the page based on the url used to get to the page. This would give you dynaically generated webpages. Additionally, we will discuss ways of storing your data in a flat file database. In these databases, we will store information about your menu items and advertising banners. Purpose: [/hr] While the use of a seperate menu script that included on every page in your website is very handy when it comes to making changes to your website menu, this is only one very small time saving tool for a web master. With the system discussed in CMS101 - Content Management System Design a full website overhaul would still require the webmaster to edit several file in the same way every time. The template of each page would need to be updated. This would take a lot of time to do and after the first 10 pages or so would get rather tedious. It would be much better to have a single template file that is used for the entire website. Then only the single template file would need to be updated when a change was desired. Editing would be simplified even more if the majority of the content for the website was stored in an easy to read and logical system of data files. This would make finding the right data to edite much easier since it would be mostly a text file. I know there have been times where I've gotten lost in my code and edited the wrong portion of the file. This would reduce those user errors most of use have encountered. For the menu script, having a seperate database file for the menu items would allow you to enter only the most basic information needed to generate the menu. Then the need to remember how to properly use the menu generation function will be eliminated. Technical: [/hr] We will first need to create a template for our website and code it to use different content based on the url used to access the page. We can use the template from the previous lesson as the basis for the new one. For now the only change will be for the main content area. To do this, we will add some code to the beginning of the file that will identify the correct content to be displayed in the main content area of the webpage then in the main content area of the template, we will insert that content. In order to identify the correct content to display on the webpage, we will need to encode some data in the url for the webpage like so: For this lesson, the url for the website will be http://forums.xisto.com/no_longer_exists/. This will be the front page or default page of the website. If we want a different page, we will need to pass a variable through the url. http://forums.xisto.com/no_longer_exists/?page=links should display a page with a list of links on it. However, http://forums.xisto.com/no_longer_exists/?page=news1 should display a page with some type of news article or articles on it. It is important to be able to display the correct conten all of the time and if an error occurs either display an error message or the default page instead of the error code that would be generated. While explaining to your user that either the data they requested could not be found or no longer exists is a very professional way of dealling with an error, allowing the user to view a generic server generated PHP code error instead is very unprofessional. To prevent this, we need to be sure that http://forums.xisto.com/no_longer_exists/?page=gjhgjhgkjg will either display the default page or a professional looking message that the content could not be found. Here is how we would retrieve the desired content from the url provided and check to see if the content is valid. <?php$page= $_GET['page'];$content_file = 'content/pages/'. $page . '.php';// Now we check to see if that file existsif (file_exists($content_file)) { $main_content_file = $content_file;}else { $main_content_file = 'content/pages/default.php';}?> We of course place that script at the beginning of the index.php file and where the content is to be displayed we insert <?php include($main_content_file); ?> like so:index.php: $content_file = 'content/pages/'. $page . '.php'; // Now we check to see if that file exists if (file_exists($content_file)) { $main_content_file = $content_file; } else { $main_content_file = 'content/pages/default.php'; } ?> <html> <head> <title>My CMS 2</title> </head> <body bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" style="font-family linenums:0'><?php$page= $_GET['page'];$content_file = 'content/pages/'. $page . '.php';// Now we check to see if that file existsif (file_exists($content_file)) { $main_content_file = $content_file;}else { $main_content_file = 'content/pages/default.php';}?><html><head><title>My CMS 2</title></head><body bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" style="font-family: verdana;"><table width="100%"><tr><td colspan="2" bgcolor=silver><?php include("header.php"); ?> <!-- Used for Banner Advertising etc... --></td></tr><tr><td width="150" bgcolor=red valign="top"><?php include("menu.php"); ?> <!-- Used for The Main Menu... --></td><td bgcolor=navy><?php include($main_content_file); ?> <!-- Here is where our selected content will be displayed --></td></tr><tr><td colspan="2" bgcolor=purple><?php include("footer.php"); ?> <!-- Banner Ads, Copyright Info., etc... --></td></tr></table></body></html> Now as long as as you create a file that matches the filename passed in the url, the content will be displayed.Here is an example: index.php?page=main --> content/pages/main.php index.php?page=news --> content/pages/news.php index.php?page=links --> content/pages/links.php index.php?page=other --> content/pages/other.php index.php?page=default --> content/pages/default.php You could also add to the script to allow you to use the same system for other parts of your webpage. you can pass multiple arguments in the url like so: http://forums.xisto.com/no_longer_exists/?page=main&header=header1 With this you could also specify which header file to use. If you had a header file named header1.php, the contents of it could be inserted in the header while the contents of main.php would be inserted in the main content area. To do this, you need to modify the script at the beginning of the index.php like so: <?php$page= $_GET['page'];$header= $_GET['header'];$content_file = 'content/pages/'. $page . '.php';$header_file = 'content/headers/'. $header. '.php';// First we check the content file and assign a value to it's variableif (file_exists($content_file)) { $main_content_file = $content_file;}else { $main_content_file = 'content/pages/default.php';}// Next we check the header file and assign a value to it's variableif (file_exists($header_file)) { $main_header_file = $header_file;}else { $main_header_file = 'content/headers/header_default.php';}?>We then add <?php include($main_header_file); ?> to the place where we want the header to be displayed. [/hr] Our next goal is to use a flat file database as the source of the menu to be generated in menu.php. A flat file database is simply a text file that uses some means of data seperation to store information. For our script we would create such a database in a new directory: databases/menu.db Search Engines|headerAlta Vista|altavista.comExcite Forums|headerAstaHost|http://forums.xisto.com/index.phpTrap17|www.trap17.comAntiLost|www.antilost.comOnline References|headerDictionary|dictionary.comThesaurusNote here that we use the pipe "|" charater to seperate the link name from the link url. We will write our script to read each line individually so each line effectively acts as the records seperator. Here is the code we will use in menu.php <?phpfunction make_menu($name, $url) {if ($url == 'header') { $link = "<span style=\"font-color: lime; font-weight: bold;\">" . $name . "</span><br>";}else { $link = "<a href=\"http://" . $url . "\" style=\"font-size: 8pt;\"> ♦ " . $name . "</a><br>";}return $link;}$handle = @fopen("databases/menu.db", "r");if ($handle) { while (!feof($handle)) { $buffer = fgets($handle); $menu_array = explode("|", $buffer); echo make_menu(trim($menu_array[0]), trim($menu_array[1])); } fclose($handle);}?> The first part of menu.php is nearly the same as the one used in CMS101 - Content Management System Design. The second part of the script replaces the old individual make_menu() funtion calls with code that will read data from the database and automatically pass the information on to the make_menu() function. This code first opens the file for reading and then begins to read from the first line. Once the first line is read and the data is processed, the code goes to the next line. Prior to reading any line, the script first checks to see if there is data on that line. This is done with the feof() function to see if the end of the file has been reached. As long as the end of the file has not been reached, the script will read each line and pass that lines data to the make_menu() function. The explode() function reads the line and breaks the data into each field based on the location of the pipe character. The trim() function ensures that only the data is passed to the make_menu() function be removing all whitespace before and after the data. The benefit of using this type of database system to store the data for your menu is that the database is very easy to read. When editing the menu, all you need to do is insert or delete lines of data where you want the menu item to be located. For those that are less interested in scripting and programing, there is an added bonus of not having to worry about damaging the script each time you edit the database since the two are seperated from one another. It should now be getting clearer how using a template or CMS system on your website can make the day to day administration of your website much easier. Please understand that this tutorial is not a template layout and design how-to. It is a tutorial on how to create a template system. For information about template layout, design and/or style, please look at forum categories related to website design. This is a PHP scripting how to. I'm not very good at the overall look and fell of website design. Please don't ask me about that type of stuff. I hope that this information will be helpfull. vujsa
  5. There aren't too many options to help this situation. If all non HTTP and Mail ports are blocked at the LAN firewall, there isn't any thing that can be done. I don't know for sure how the PHP ftp functions work when it comes to ports. It may be that we can set up a php based ftp system for you that would work if it was hosted on your Xisto account. It is still a lot of work to write but if you look around at http://php.resourceindex.com/ , yo may be able to find what you need pre written. Since the comands sent to the serve are from the server, your LAN may never be involved with the transaction other than to submit the form and reply to the data. I think this is how the flow of data works for a php based FTP transaction: Your computer -> Your LAN -> Xisto web server -> Xisto FTP server -> Xisto web server -> Your LAN -> Your computer Given your situation, I think that it would be worth he time to test a few web based ftp scripts. vujsa
  6. The menu is a very simple way of explaining this principle in PHP. Since most people use some type of menu in their website, this technic can be easily applied to most websites. Imagine that your website is rather large (50 static pages) and you wanted to add a menu item to your menu bar that is on every page. You would have to edit 50 pages right? If the menu was a seperate file which you just included on every page, then only the one menu file would need to be edited right? The make_menu() command is actually a user defined function that was written in the begining of the script. The code you pasted simply sends information to that funtion and then the function returns the end result. As far as being flexable, PHP is just a control. When used to make web pages, it controls what HTML will be sent to the use's web browser. That is all it does really. JavaScript and CSS are parsed on the user's computer which allow them to offer dynamic features on otherwise static pages. I hope this clears a few things up for you. vujsa
  7. Very nice followup to my tutorial. Well written and easy to follow.The PHP include function has really made the job of a webmaster much easier and this tutorial proves it. If someone had used my tutorial to build their menus on their website and then read your tutorial and wanted to convert their menu to a more up to date method, it wouldn't be very difficult. Only one file would need to be changed. :oKeep up the good work.vujsa
  8. Well, yes you can write a file upload script in PHP with little difficulty. You could even write an entire file managment system in PHP if you were really serious.Most of the file upload, delete, copy, and move options are easist if you use the PHP ftp functions since using the file system functions can leave your files with the wrong ownership. Basically, using PHP file system functions to upload files sets the server as the file's owner instead of you. Using the ftp functions requires you to provide your password and user name but sets the file's owner as you.The requirements to list, browser, and manipulate the file system structure can be a little complicated since you'll probably be using several PHP file system and FTP functions at once along with environmental variables and authentication to allow you to only enter your username and password once per session and expire after so many minutes.I think you can stat to see that the requirements exceed the novice or beginner level.I would suggest using the ftp option instead of the cPanel anyhow. You can find several topics regarding the use of FTP with yur account throughout the forums. I use CuteFTP but the built in Windows XP FTP client will work as well.Just go to "My Network Places"Click add new Place.Enter your ftp address. (ftp.myaccount.astahost.com)Specify your username.etc...You'll then have a direct connection to your account from your computer. It'll look just like your windows file structure. Then you just need to drag and drop files from local folders to remote folder or copy and paste. It works pretty well actually.For more advanced FTP features, I recommend a third party FTP client. I think you'll find FTP easier to use in most cases than the cPanel File Manager.Good Luck. :ovujsa
  9. This isn't a PHP question. mod_rewrite will only work on Apache installed on *nix servers I believe. I don't think it will work on Windows. http://httpd.apache.org/docs/1.3/mod/mod_rewrite.html vujsa
  10. I'm using Joomla to run my website and I've designed a new template from scratch. I've had more than a few difficulties trying to make the site cross-compatible but so far it is working for Netscape, FF, Mozillia, and IE. Didn't bother with the others yet. In IE, the page fills from top to bottom of the window. My footer rests happily at the bottom of the window where it should be. In Netscape, the bottom of the table sits above the bottom of the page if the amount of content doesn't fill the entire page. Example: http://forums.xisto.com/no_longer_exists/ If there is enough content, this isn't a problem. Example: http://forums.xisto.com/no_longer_exists/ So my question is, how do I force the footer to the bottom of the page even if there isn't enough content to fill the page? I'm sure this is a pretty simple thing I've just overlooked but right now I'm stumped. Thanks, vujsa
  11. If I'm understanding you correctly, you want to remove the space at the top of your webpage. This is caused by your HTML editor. You are probably using some type of wysiwyg html editor like the Netscape Composer editor. One of the many drawbacks to these types of editors is that they add junk to the code that you don't want or need. Look at the source of your code: There is probably a non-breaking space added right before your table: <body ... > <table ... > There may even be a line break inserted: <body ... > <br> <table ... > You just need to remove the extra code: <body ... > <table ... > If all else fails, you can manually set the top margin to zero in the body tag: <body top-margin="0"> <table ... > Hope this helps. vujsa
  12. I'm pleased to hear that you enjoyed your visits to Xisto. The entire staff works very hard to maintain a clean and nearly spam free site. Let me try to explain hoew the two forums really differ. It is true that Xisto deals with much more technical subjects. Because of this technical nature, the forum has a lot of technically minded and very organized members. The more organized, technically minded, and very active members are invited to join the staff. Since most very organized people tend to do things in an organized way, the forum naturally follows this pattern. When the forum starts to get disorganized, one of us makes a post in the staff section to plan a cleaning party. We stear non-technically minded members to Xisto.com. We professionally inform members when their posts and topics are not up to the standards we expect. We also train borderline members to be better members. If a member doesn't seem to be technically minded enough but has pretty good posts otherwise, we look for ways to help the member keep up with his credit count. Most of us are just waiting to answer a question from a member that needs help. The best way to start a good discussion is to ask a good question. This is where our technophobes help out. They ask technical questions that allow the rest of us to answer and discuss the question. I wish we had more easy questions to answer sometimes, maybe I could break 200 credits finally. Anyway, even if you aren't a programming guru, Xisto has something to offer you. If you are a spammer, plagerizer, one liner poster, or generally dumb, don't bother coming to Xisto, you won't last long. Some new members don't even get a full hour in before we boot them. I someone is really bad, we will just invite them to leave. No reason to bother Xisto with them. So for my opinion for you is to do what you like. I'd hate to tell you to make the move them send you one of those PM's next week. vujsa
  13. Actually, our hosting server will extract many compression formats including zip files.- zip- gzip- tar.gz- tar.bz2 - etc...I sometimes edit a large number of files for use on a test site and then if they work correctly, I create a zip of all of the files I edited in their correct directory tree starting from /public_html. I can then upload and extract the files to a temporary directory (/temp) on the server. Once on the server in the correct directory structure, I can copy the root directory created by the extraction to the target directory of my website. All of the files that need changed are automatically overwritten. I can update my live site very quickly this way.As far as every file that is extracted having the wrong file permissions, I found that my standard FTP client allows me to quickly CHMOD several files and directories at once. :huh:You can't extract to the target directory since the extractor will not overwrite files in the extraction process. Only the upload, copy, or move processes are able to overwrite an existing file.Nice tutorial.vujsa
  14. Actually the idea of converting your HTML file to PHP files is not a ridiculas as everyone has suggested. If fact I think that most of the reasons not to do so have been pretty short sighted. There are a number of reasons to convert your HTML files to PHP. The biggest reason is to prepare the file to use PHP scripting. For example, if you wanted to add a PHP include to your page, the file would first need to be converted to PHP. It doesn't matter if the PHP file actually contains any php coding or not. All you really need to do is change all of your files extentions from .html to .php and edit any internal links form .html to .php! Your biggest problem will be a large number of dead links since your HTML files will no longer exist. As a result if you url is listed in search engines and other sites, the links will no longer work. Here is a solution for that problem: http://forums.xisto.com/topic/88716-redirecting-all-htm-files-to-php-site/ ====================================== The benefit of using a PHP include in your page is that you can include the contents of a file where ever you decide on your page. (basically where ever you place the include) The most common use of this technique by new PHP users is a site map or menu. You can write a single file that contains all of your menu information and insert that files contents into each of your web pages. Then if you want to edit your menu, you need only to edit the one file one time. For more information, see this post: http://forums.xisto.com/topic/86340-cms101-content-management-system-design-basic-cms-with-php-includes/ You might be able to get someone to write a script to convert your files and clean the links up inside the files. I would help but I'll be out of town for about a month. Good Luck. vujsa
  15. I'm a bit of a fan of the CSS image rollover effect. I guess in theory, you design your entire website using a single image. I mean if you placed every graphic you needed in a single image and noted the coordinates for each item, it would work. I created a push button effect with my CSS. My Website: VW One Feel free to take a look at the CSS file and image to get a better idea of how it works. If you don't know how to find this information, view the page source in your browser. I like the feature becasue I don't have to keep track of as many images. It is a lot easier to code than JavaScript and it will work on all of my pages with just a link to the CSS file. I know that I can write a JavaScript file and link to it but I still find the CSS easier to use. I reserve JavaScript for things that CSS can't do. I've not had any compatability issue with modern browsers other than IE being a pain to code for. vujsa
  16. First of all, you have a code fragment at the begining of your page. This looks like a missing quote somewhere in your code.Remember that because of the way that SMF works, the error may be in a file other than post.php. It could be an error in index.php as well. The fragment seems to be from the modify function. If you originally installed the mod with the package installer, there should have been a backup made on the files it cahnged. If that is so, uninstalling the mod using the package installer should take you back to a good configuration.It might help if you made a copy of post.php and name it post.txt and give us the link to it so we can see the files contents. Also, I suggest providing the link in the forums at SMF since they are more familiar with the code there than we are.vujsa
  17. What was the last mod that you installed? You should be able to reread the installation instructions for that mod to remove the mod altogether. If your forum begins to work correctly after removing the mod, you'll know for sure it was either the mod or an error in installing the mod. If after the mod is remove everything is working correctly, make a backup of each file that is changed by the mod. I usually download the file, in this case post.php and then make a copy of it on my system named post.php~. Now I have two identical files: post.php post.php~ I can now edit the original file. Install the mod one more time on the original files and then upload the both versions of the file (post.php and post.php~) to the server when done. If the problem occurs again, just delete the .php files and rename the .php~ files to .php. I reccomend always creating a backup prior to editing a file. If you have added several mods, then you should create a backup prior to each. Like so: post.php post.php~1 post.php~2 post.php~3 post.php~4 post.php~5 Where post.php~5 would be the newest backup. Even beter would be to date the backup: post.php post.php~11-21-2005 post.php~12-13-2005 post.php~01-07-2006 post.php~01-26-2006 post.php~02-08-2006 This way you can quickly remove bad mod installations. Once you are sure that a backup is no longer needed, I suggest moving it off of your server to your local system and making a zip file of all of the removed backups. This will save space on the server for other things. Have you rechecked your edits? Sometimes just going through the installation instructions again and checking to see that what you did is what you were supposed to do can isolate the error. Maybe you place the new code before something when you were supposed to place it after. Stuff like that. Maybe the mod you used isn't compatible with another mod you installed or is incompatible with the version of SMF you are using. I know that this may not be the answer that you are looking for but without seeing the errors that you are having and without knowing what the code looks like now and what it looked like before, it isn't posible to narrow the list of possible causes. vujsa
  18. Most third party webscript come complete with a standard template, color scheme, graphics set, logo, favicon, and of course a copyright notice. Since most of these scripts are open source these days, we have a lot of room to modify the original script as long as we don't redistribute the modified script.* In fact, even for most paid scripts, we are allowed to modify the script to suit our needs. It would be nearly impossible to stop most of us from making such modifications. Here is a list of things you should change to complete the installation of your website. TemplateThe template has more influence on the appearence of your site than any other component. Search for and view ready made templates for your web script. Check the homepage of the web script you are using. There will probably be a list of submitted templates that are ready to use.The downside to this is that many of these homepages don't offer a way of previewing the template without installing it on your website. Run a search engine query for your scripts templates.Remember that templates may be refered to as many things. - myscript skins - myscript templates - myscript themes Try to find site similar to your site for ideas that work.This doesn't meen copy the cloesest site you can find. Check for other sites using the same script as you or providing similar content as you. If your website is about books, a website about magazines may provide you with ideas. Using a wysiwyg editor, make a rough draft of the way you want your website to look.Just try to get all of the content blocks in roughly the right spot. You can use the editor to quickly change various component colors to find a color scheme that you like. Edit the template files to customize the page for your final needs.In many cases, your template core files may need to be alterd to get the right look. Most web scripts weren't designed to easily move a component from one place to another on the page. This would require you to modify the file as a result. If all else fails, using a basic template, designa new template on your own.This can vary in difficulty depending on the script you are using. Something like Mambo or Joomla is very easy since there is only one template file and it is 95% HTML. A forum template may have dozens of template files and be 45% HTML and 55% PHP. CSSOnce you have the layout you want from the template you chose or designed, you'll want to customize the CSS. The Cascading Style Sheet (CSS) is an extention of the template set. Without it, the template will not work. The CSS controls all of the color information as well as the positioning and size of the various components on the page. As a result, simply changing or writting a new CSS for your template would drastically change the look of your website. Here is where that wysiwyg editor really comes in.Most wysiwyg editors have really nice color choosing features which will make the process go a lot faster. Make several different CSS versions.Once you have a CSS that makes your template look the way you want it to, us it as the basis for a second or third CSS file. You can then quickly compare color schemes and styles to pick the most suitable look. GraphicsBy now you have noticed that the graphics that came with your template may no longer match the rest of your site. If you have made major color alterations to your site, then the graphics are probably the wrong colors. Make a backup of the default template graphics. Make your graphics fit your colors cheme and layout.You have two options for doing this. Alter the default graphics to match your website's look. Design new graphics to match your website's look. If you choose to design new graphics, you may find it helpfull to visit a clipart and icon website to get inspiration and more importantly artwork. Why bother spending hours designig a new people icon when there are thousands that are already made. You can then concentrate on the parts of the graphics that effect the look of your website. Basically, if you want to design a new "members" button, use a stock people icon on your new button background. LogoYour log is what tells everyone that visits your site what our site is about. If your site is about your company, then the site logo should use your company's logo. If your website is your company, then the logo should convey the purpose of the website. You want to gain the interest of your visitors right from the start. Be sure that you logo matches the look of your website. Also, make sure that your website matches your logo. This is where paople make a lot of mistakes in the design of their website. Fav IconThe favicon is an image that is displayed in the browser bookmarks next to the bookmark, in the browser address bar when the page is viewed, and on the browser tab next to the website name in tab browsing capable web browsers. This is usually a much smaller and more simplified version of your logo. You really need to change the defult favicon that comes with youe web script. At the very least, delete or rename the default favicon. It tells your visitors that your page is unfinished if it doesn't match the rest of the website. CopyrightThe copyright notice or the powered by notice in the footer of most web scripts can be removed in many cases. The relly depends on the scripts author but if the script is distributed under the GNU/GPL license, the powered by notice can almost always be removed from the footer area. The GNU/GPL license usually allows for the removal of the copywrite notice located in the footer area of the website. Under no circumstance can you ever remove the copyright notice located in the source files of the web script you are using. There may be restrictions that won't allow you to remove a "page generated by myscript" from the meta tags of your site. I highly recommend that you contact the developer of the script that you are using a ask for the specifica regarding the removal of such notices. Being able to remove these notices will give your website a more professional and unique look. Just by making slight adjustments to each of the items in the list will really polish the look of your website. Sometimes the smallest change is the one that effects the user the most. It could be by making a popular link easier to find or highlighing an important area or the page. Some of you may have very successful websites already and are afraid to make these kinds of changes. You can make slight adjustments of a longer period of time to prevent update shock to your users. Maybe once a week chance one little thing. Just be sure that what you change this week will still match everything on your website. For example, if you intend to use new graphics, but haven't changed the colors of your website yet; make new, temporary graphics that match the old colors until you are ready for the new colors. While the default components of your web script may look very good, remember that there are a lot of lazy people out there that would have a website that looks identical to yours. Then instead of a Joe's Cars Website, you'd just have another myscipt website for Joe's Cars. Individuallity is the key to sucess here. I hope this is useful to someone. vujsa *Actually many open source scripts allow for the redistibution of the modified script and allow for a fee to be charged for the changes only. For more information, see the details of the GNU/GPL License.
  19. I've given this some thought and decided that you could also use url redirects in your .htaccess instead of mod rewrite: The upside to mod rewrite is that the user never knows that the page has moved. the page still appears to be whatever.html! But that means that you could end up generating more and more links to the .html pages by users bookmarking the page with the outdated url. If you use a redirect rule instead, you could then display the actual new url. It works much the same way as modrewite: RedirectMatch permanent ^(.*)\.html$ $1.php So your .htaccess file would look like this instead: # First we have our specific rules:RedirectMatch permanent ^deadlink_20\.html$ index.phpRedirectMatch permanent ^deadlink_13\.html$ index.phpRedirectMatch permanent ^deadlink_1\.html$ index.phpRedirectMatch permanent ^oldlink_5\.html$ index.phpRedirectMatch permanent ^oldlink_1\.html$ index.php# Then we have our general (default) rule:RedirectMatch permanent ^(.*)\.html$ $1.phpRedirectMatch permanent ^(.*)\.htm$ $1.php# We always leave a blank line at the bottom of the file. This may be a better solution for you since it would eliminate the chance of outdated urls being bookmarked or indexed. Alternatively, you could use a combination of the two. Have the converted pages redirect to their new versions and have dead links rewrite to index.php: # mod_rewrite in useRewriteEngine On# First we have our specific rules:RewriteRule ^deadlink_20\.html$ index.phpRewriteRule ^deadlink_13\.html$ index.phpRewriteRule ^deadlink_1\.html$ index.phpRewriteRule ^oldlink_5\.html$ index.phpRewriteRule ^oldlink_1\.html$ index.php# Then we have our general (default) rule:RedirectMatch permanent ^(.*)\.html$ $1.phpRedirectMatch permanent ^(.*)\.htm$ $1.php# We always leave a blank line at the bottom of the file.Note that I left the order the same to prevent a url being redirected before it could have been rewritten. This would cover most of your situations and either reduce the number of requests on obsolete urls or hide the fact that some pages no longer exist by serving up your index.php instead. I haven't had any trouble with Google indexing my site by using mod rewrite. Infact, I use mod rewrite to make it easier for the robots to index my site. Some of them get confussed by the long php query urls (index.php?action=whatever&location=whereever). Keep in mind that using .htaccess files carries with it no dangers. The dangers come from the commands that you place in it. A bad mod rewrite rule will cripple your website. In fact while doing some testing to help answer this question, I accidentally disabled the Free Web Hosting Application Form for both Xisto and Xisto. I rewrote all of my root directory PHP files as HTML files. Since I don't actually have a req_form.html file, a few members got a "404 - Page Not Found Error". A general redirect rule like I have shown you would be just as debilitating to my website. Be sure to add rules to offset a general rule if you need to exclude something. I believe that rules are only run once on a n incoming url so if you set specific rule to redirect or rewrite to itself first, you would effectively exclude that url from the change. Say for instance you have an HTML file that you don't want to convert and you wanted to exclude it from the rules above: RewriteRule ^myHTMLpage\.html$ myHTMLpage.htmlSince this is a very very specific rule, you should place it at the top of the file. ============================================ There is another option to all of this, we could write a PHP script that would check and see if the requested PHP file exists. If the file does exist the script will serve that file otherwise the index.php file will be served. This would consist of a mod rewrite rule to change the .html url into a .php query url to the redirection script. The redirection script (maybe something like /redirect.php?file=mypage) would then use the file name as the basis of a check to see if a .php file of that name exists. If that file does exist, redirect to that file. If not, redirect to index.php. I would be happy to discuss this further in the apropriate forum if you are interested. I hope this helps. vujsa
  20. This should do what you want: # mod_rewrite in useRewriteEngine OnRewriteRule ^(.*)\.html$ $1.phpRewriteRule ^(.*)\.htm$ $1.phpIt'll take any file.html and return file.php instead. No matter what the name of the HTML file is, the server will return the equivalent PHP file. Note that I have a rule here fore both .html and .htm, the .html rule should com first since .html contains .htm. If you put the .htm first, then the server could change your file.html to file.phpl. See how that works? If you don't understand that part be sure to ask, it is very important. The rewrite engine picks the first match even if there is a better rule after it. If you have other rewrite rules to include, be sure to put them above this rule since this rule is the most general. It is usually used as the default setting.. If the file doesn't match any specific rule, then just change the file extention to .php from .html. I would also check your error logs and find out which links may be dead on your site. Pages removed, pages renamed, etc... Then write specific rules for your dead links to be rewritten as index.php. The specific rules should always come before the general rule. So here would be a better .htaccess file for you: # mod_rewrite in useRewriteEngine On# First we have our specific rules:RewriteRule ^deadlink_20\.html$ index.phpRewriteRule ^deadlink_13\.html$ index.phpRewriteRule ^deadlink_1\.html$ index.phpRewriteRule ^oldlink_5\.html$ index.phpRewriteRule ^oldlink_1\.html$ index.php# Then we have our general (default) rule:RewriteRule ^(.*)\.html$ $1.phpRewriteRule ^(.*)\.htm$ $1.php# We always leave a blank line at the bottom of the file.You'll have to replace the "deadlinks" above with your own information. Notice that the deadlink and oldlink files are in reverse numeric order to prevent deadlink_13 being rewitten for the rule for deadlink_1. It is that same issue as above where rewrite looks for the first match, not the best match! You should leave a blank line at the bottom of the file so that cPanel has a place to insert commands if need be. I don't remember for sure if this rule will effect all subdirectories or not so you'll need to do some testing and checking. Good Luck. vujsa
  21. What you want to do is use mod rewrite. Basically, here is what mod rewrite will do: User types in http://forums.xisto.com/no_longer_exists/ the server takes that request and coverts the url to http://forums.xisto.com/no_longer_exists/. Then the requested php page is served. You'll need to create or edit yout .htaccess file in your /public_html directory. # mod_rewrite in useRewriteEngine OnRewriteRule ^mypage1\.html$ mypage1.php Now you could simply forward all html file requests to the index like so: RewriteRule ^(.*)\.html$ index.php For more advanced php style mod rewrites, here is what to do: RewriteRule ^mypage2\.html(.*)$ index.php?act=mypage2$1/mypage2.html?&section=section1 would point to /index.php?act=mypage2&section=section1 Now you may notice the (.*) right after the .html, this means everything at that location of the url. So if you were doing a lot of mod rewrites and you missed something, your link wouldn't be broken. Whatever in located in the position of the (.*) will be inserted at the end where you see the $1. You can place a more specific rule in the () if you prefer. You can also use the command multiple times like so: RewriteRule ^/(.*)mypage2\.html(.*)$ index.php?act=mypage2&section=$1$2/section1_mypage2.html would point to /index.php?act=mypage2&section=section1 I think you'll need to let us know what rules you need help with. I don't know what your drirectory looked like before or after your changeover. I hope this helps. vujsa
  22. I wrote an article a while back that may help you out. http://forums.xisto.com/topic/82436-topic/?findpost=1064293081 You may lose some of your data because the old files are corrupt but the data recovery program should get most of it. I'm not sure how the blackmail worm works so it is hard to say for sure that you'll get your data back. If the worm writes zeros to your hardrive, then you could have a problem. Good Luck. vujsa
  23. Yes, you have to use the session_start() function on every page to let the script know that you are either starting or continuing a session. There isn't any reason for PHP to work with sessions in many cases so instead of running the server's session engine all of the time and usually unnecessarily, you simply tell it the maybey 20% of the time it is used. The reason we use session_start everytime is that the programmer of this function had the foresight to make our lives easier.If we used session_start() to start our session but a diferent function to continue the session, we would then have to add a check on every page to see if we should start a new session or continue an old session.vujsa
  24. The php session is really quite easy to do. The session data is stored on the server so you don't need to use any other resource like mySQL. The session will save whatever variables and values you want to the server. To start a session do the following: session_start();To set a variable and value to the session do this: $_SESSION[username] = 'vujsa';If you want to set a session variable but give it no value, do the following: session_register('counter');There isn't really any reason to register a variable and not add a value but there it is anyway. Using that same variable, instead of just registering it without a value, we can set the value to a number like one. Like so: $_SESSION[counter] = 1;Then later we could increase that variable each time a page is loaded. $_SESSION[counter]++;This will add 1 to the value of the session variable named "counter". If you do this each time a page is loaded, you will keep track of the number of times the user has loaded one of your pages during the current session. But you'll need to check to see whether or not the variable counter has already been set before assigning a new value to it. <?php session_start();if ($_SESSION[counter]) { $_SESSION[counter]++;}else {$_SESSION[counter] = 1;}?> Remember, the count is only for the current session. If the user leaves and their session expires, the count will be lost. Also, in order to use sessions, the user must accept your cookie. If their browser can not use cookies or they do not accept your cookie, your sessions will not work. You should be sure to design a backup in the acse that your sessions don't work. I assume that you want to use your sessions for things like keeping track of a member after he logs in. If that is the case, you'll need to have a login script that uses a database and has some degree of user authentication in place. You'll always start a session when someone comes to your site. The only difference between a guest and logged in member is that the member's seesion will have a logged in variable. For example, after the user has entered his correct username and password, your login script should set a session variable like so: $_SESSION[logged_in] = 'yes';Then on your member only pages, you would check to see if the member is logged in or not: <?phpsession_start();if ($_SESSION[logged_in] == 'yes') { build_member_page();}else { build_login_page();}?>Of course, the two functions (build_member_page() and build_login_page()) would need to be real functions that actually built a page. You could also add a variable for member type if you wanted to make certain pages only availible to Admins or Staff. [/hr] This is a very basic session system. It won't last long after the user leaves and it can't determine what permissions each user has. For best results, you should a database with the sessions. mySQL is a free and widely availible database system that is offered on most hosting accounts including the hosting accounts here at Xisto. The best part of using mySQL, is that it is much easier than the old days with flatfile databases (all of the data was stored in a text file with seperators like "|" ). You can set the session ID in the database to be the same as the session id on the server. This way, you can store more perminent data than with the session alone. This way you can save user preferences or simple keep track of whick user file is associated with the session being used. If you have a database table that stores the username used for what session, then you could use the session ID to retrieve member information like user preferences so that your user can customize the look of your site to their taste. That way if your user ste their background color to navy blue, it would always become navy blue as soon as they logged in. It would be difficult for me to explain more about how to use sessions in PHP without knowing for sure what you want to do with it. For more information, I suggest that you look at the php manul regarding PHP sessions. http://us2.php.net/manual/en/function.session-start.php Hope this helps! vujsa
  25. I suggest not using relative urls. I understand the though behind using relitive urls but if you are building the url with PHP anyhow, I suggest using some of the built in PHP file system functions to build the link. I think this link may help. http://us2.php.net/manual/en/function.realpath.php This way you'll have all of the benefits of using a relative url for the script but the link that the browser will see will be absolute. You would need to run a few more functions on the variable before it would be usable as a url. Hope this help you. vujsa
×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | 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.