Jump to content

Newbie Help!


raefuun

Recommended Posts

Hey guys~

I know this isn't exactly a code I need help with, but I'm so lost with this whole thing that I came here.

 

My site is here: http://bos.macroscopy.net/

 

The problem I'm having is that I cannot figure out how to create pages that will load inside of the "body" area (the text area with the big glowing book). I am NOT talking about using an iframe, but rather having the site layout load up on every page listed on the SIDE BAR the way the TOP BAR's pages do. I tried creating just .html pages and linking to them the way the top bar's a href= tags seem to direct, but it doesn't load anything but just the .html page's contents. I tried creating folders and just copy+pasting the contents of the 'template' (main) directory into the new folder but all it does is take me back to the 'template' directory's pages. What I don't want to have to do is list every little page on the topbar just to be able to create pages. :(

 

I have been using some free-to-use engine called Template Blocks, and I understand I will probably not be able to edit these pages withing the Template Block's admin/editing pages. If someone could show me how to do one page, I'm pretty sure I can do the rest myself. :)

 

Any help at all would be SO appreciated! I'm a 100% beginner at PHP, so please be patient with me haha.

 

Link to comment
Share on other sites

Try to lookup ways to use includes in your code.

 

You can create seperate htm (or html) pages and call them into an index page kinda like this:

<?php include 'menu.html'; ?>

 

Applied in a html file:

<html>
<body>
<?php include 'menu.html'; ?>
</body>
</html>

 

 

However, I think that you need to have something set in an .htaccess file that will allow for php to be parsed within a html file

Link to comment
Share on other sites

I'm not sure exactly what you want, but I think I do, so I'll take a stab at it...

You want the page content to be loaded in the large area where the book is located, so that when you click on one of the links on the left it looks/works like the top links do?

 

Maybe I'm missing something, or maybe it's because I don't know what the original template looked like, but I don't understand why you can't just take the default page of the template, set the links up the way you want them to be, then copy that index.html file into all the directories you have set up on your left bar links and then you just individually edit the content of each page to reflect what you want.  As you note, it's not a php issue, since there's no php on the page (of course, I don't know how the template is set up, either...does it use php somewhere?

 

If I'm totally whiffing on what you're trying to ask, let me know.

Link to comment
Share on other sites

I'm not sure exactly what you want, but I think I do, so I'll take a stab at it...

You want the page content to be loaded in the large area where the book is located, so that when you click on one of the links on the left it looks/works like the top links do?

 

Maybe I'm missing something, or maybe it's because I don't know what the original template looked like...

 

YES, EXACTLY! What i want is for the side bar links to load the same way the top bar links do!

 

I did try to copy the index file to their own directory, but when I accessed those pages it came up with a bunch of php errors (For an example, click the "Health & Beauty" link on the left side bar). I tried copying the index.php file, and parts of the directories, but I haven't tried copying (and preserving the directory's folder/subfolder levels (idk if I worded that correctly).

 

I'm definitely going to give that, and ultraloveninja's suggestion a try. Thanks to the both of you for such helpful and quick responses.

 

FY(&others')I:

http://demo.templateblocks.com/

This is the original version of the engine you can download (http://www.templateblocks.com/download.html). All I really did was put in a layout, haha.

Link to comment
Share on other sites

Scarhand, your code seems to be along the lines of what I need to do, but again, I don't understand how to make that code function the way the top bar does.

 

I think what people are missing here is the fact that I have no experience with php before and I'm learning it as I go, and just giving me a code isn't going to show me where to put it to get the results I'm looking for. Thank you nonetheless for the help, though, everyone. :)

 

 

Link to comment
Share on other sites

Do you want the quick, dirty, and easy way to fix the problem, or do you want to slog through everything, breaking and fixing a bunch of stuff, learning some php as you travel down that long road?

 

The quick fix: 

[*]Copy the html source code as it's sent to your browser (right-click->view source

[*]make that the index.html file.

[*]Edit it and get the links pointing to the directions as you want them

[*]Copy the index.html file you created into the proper directories

[*]Edit the index.html file in each directory so that the content is what you want

 

 

The bottom line is (and I suspect by your original posting that you really already know this...) that you don't need php to accomplish what you seem to want.  Your problem is that the template library uses PHP as the library backend to generate and serve up the templates.

 

You're not trying to do anything with this page that requires dynamic content, hence no need to mess with PHP.  If you do want to learn PHP, there are much better environments to screw around in (ie creating your own pages from scratch) than trying to mess around with a 3rd party html template engine. 

 

I know, I speak sacrilege--"Don't use PHP!" on a php website.  But, like my dad and the Boy Scouts taught me:  ALWAYS use the right tool for the job.  The job you want done just requires straight-up HTML for the pages.

Link to comment
Share on other sites

I did think that this would be easier to do via HTML, to be completely honest with you.

 

What I was hoping to accomplish by using php was to have navigation bars that, if I edited some of the contents on one page, I wouldn't have to manually edit that same area throughout the rest of the pages by hand. I thought that with this engine I downloaded, it would allow me to work around having to do all those kinds of manual changes.

 

So I guess my final question before I mark this topic as solved is: Is there any way to accomplish what my original intention for the menus is? If so, is it through php or somethig else?

Link to comment
Share on other sites

The quick and dirty method is to use php to create the html for that menu, (store it as a string variable such as $output) then just have php echo that at the appropriate location. 

 

The easiest way to get it in the right spot is to create the layout as a table with borders turned off and no space between the cells.  In the cell where you want the links to appear, have the php create a nested table in that cell and put the links there, each as a separate <tr><td><a link stuff here></td><tr>

 

I hope that makes sense...I know it's a bit of a scatterbrained explanation.

 

All this with the caveat that it's not the compliant way to do it, but it was long the way most designers did it until recently when they all started relying on CSS to achieve the layout.  You CAN use CSS to get the same affect, but that's a steeper learning curve.  Get your site up and running with tables/php first so that it's working, then you can start experimenting with CSS margins and such....

 

That's my recommendation, although I suspect the hard-core php'ers are rolling their eyes right now.  (But is IS the path I took to learn on my own, so there's always that...)

Link to comment
Share on other sites

use divs and use this script to hide divs and show divs:

 

<html>
<head>
<style type = "text/css">
.hide {
display: none;
}
</style>
<script type="text/javascript">
function switchContent(obj) {

	obj = (!obj) ? 'sub1' : obj;

	var contentDivs = document.getElementById('container').getElementsByTagName('div');
	for (i=0; i<contentDivs.length; i++) {
		if (contentDivs[i].id && contentDivs[i].id.indexOf('sub') != -1) {
			contentDivs[i].className = 'hide';
		}
	}
	document.getElementById(obj).className = '';

}
</script>
</head>
<body>
<a href = "#" onclick="switchContent('sub1');">Home</a>
<a href = "#" onclick="switchContent('sub2');">guestbook</a>
<a href = "#" onclick="switchContent('sub3');">photos</a>
<a href = "#" onclick="switchContent('sub4');">contact</a>
<div id = "container">
<div id = "sub1" align = "center">
home</div>
<div id = "sub2" align = "center" class = "hide">
sub2 area</div>
<div id = "sub3" align = "center" class = "hide">
sub3 area</div>
<div id = "sub4" align = "center" class = "hide">
sub4 area</div>
</div>
</body>
</html>

 

copy and paste this code and see if you like to do it this way

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.