Building Web Page
20 posts
• Page 2 of 2 • 1, 2
Re: Building Web PageYes... I see what you are talking about. I think I just need to spend a little time working with this... but you did a great job once again...
Re: Building Web PageActually, if you know a little php, and probably you already do, creating a frontend drawing data from the same MySQL tables that you populate with Xataface is actually pretty easy to accomplish. This frontend that advertises my business does just that:
http://www.thedocumentsguy.com/ Each page of this "document" is a database record maintained via Xataface. The front end consists of a single php script, a single MySQL query, an index.php redirect to initiate the first query and an .htaccess to format the urls. The php script calls the query and functions as a template using css to format the content. Here's the php script:
Here's the query:
Here's the .htaccess:
Here's the "index.php" file that starts the ball rolling:
You'll likely notice that the "pages" of this document have really long and unusual page names. That came about because of Google Ads. When I first set up this site using page names like "home", "introduction", and other such single word generic names, the Google Ads I was getting were totally not related to the business I'm advertising. Such stuff as "Gay guys blah, blah, blah..." , "Hot singles, blah, blah, blah...", "Swinging this and that...". After some trial and error I discovered that the Google Ads that showed on the pages were being influenced by the "Guy" in my website name "TheDocumentsGuy" because the individual page names were not distinctive. So to get Google to throw more relevant ads, I changed the page names to what they are now. Putting "opensource" in each page name got rid of all the junk ads. Michael Mike Wassil
Re: Building Web PageThanks Mike...
I will play with this a see what i get going. Butch
Re: Building Web PageWell... Mike
Guess I am missing something. all I seem to get is The page: "" has been renamed. Select one of the action tabs above. Just so you know what I have done.. I have a table called 'home' with a field called 'name' - in that that is where I have my body text with html tags. I have the dbq1 query point to this db and table I am sure I am off on how this is to work... can you point in the the right direction..? Thanks Butch
Re: Building Web Page
Possibly a couple of things. First, I didn't intend for you just to drop in the code and it would work. The code is specifically written to work with my database and directory/file structure. So you have to modify a bit to fit your situation. You must make sure the table and field names in your database match whatever "dbq1.php" is looking for. Specifically:
change "Pub" to whatever your actual table name is, and change "Name" to whatever your actual field name for the record name is. The query is case sensitive, so be sure of matching your table and field names exactly, thus in your case:
The query is finding your database, otherwise you'd get a php error. "The page: "" has been renamed..." means the query is not finding a record, either because it didn't find the table or didn't find a record in the table with the page name requested. I think it likely found the table, otherwise you'd get a "Couldn't execute query" error. The "$no" variable is just a more sophisticated "404 error". To see how $no works correctly, hit this link: http://www.thedocumentsguy.com/page/new.html If your "The page: "" has been renamed..." looks similar, you're getting close, that is, it's displaying header and footer stuff but just no page content! To avoid $no you have to have an actual record in the database table with a field labeled "name" and some content in that field. Then you can enter a URL like:
You also have to have a field labeled "Main" with something in it in order to display any content for the page. But the page should display OK with or without any actual content. Note: you can rename the field "Main" to anything you like, but make sure you change dbq1 to match your field name:
Second, you must have the .htaccess file set up correctly, hence:
"get1.php" must be the same as whatever name you gave the above "php script". I used "get1" because it's getting a single record for a single page. You can name it anything you like, but the .htaccess file must point to it in order for everything to work as designed. Here's my directory/file structure, which might help you see how things are laid out: root (the documentsguy.com) .htaccess dbq1.php get1.php index.php ..... css (dir) .......... default.css ..... inc (dir) .......... header.php .......... footer.php Make sure you've got some html header stuff in "header.php". Put </body> and </html> in "footer.php" or at the bottom of "get1.php" (or whatever you name it) if you don't want to have a separate footer file. By the way, header.php should not contain </body> and </html> and footer.php should not contain <html> and <body>. Also, using .php instead of .html enables you to create html files that have tags missing without causing problems. In this case, since both the header and footer files are being included, get1.php combines the html elements from those two files into a single completed properly tagged html page. Of course, for testing purposes, you can leave out the header and footer includes, and just put the correct html tags in get1.php until you get it working. If you still can't get this working, please include your database name, field names, your version of dbq1.php, get1.php and .htaccess and I might then be able to troubleshoot it for you. Hope this helps, Michael Mike Wassil
20 posts
• Page 2 of 2 • 1, 2
Who is onlineUsers browsing this forum: No registered users and 8 guests |