SitePoint Sponsor

User Tag List

Page 2 of 3 FirstFirst 123 LastLast
Results 26 to 50 of 56
  1. #26
    Twitter: @AnthonySterling silver trophy AnthonySterling's Avatar
    Join Date
    Apr 2008
    Location
    North-East, UK.
    Posts
    6,111
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Debbie,

    Let's try and keep your thoughts and questions on this subject in one place, most of these replies could have been avoided if only people had seen your other thread.

    I've merged these threads.

    Anthony.
    @AnthonySterling: I'm a PHP developer, a consultant for oopnorth.com and the organiser of @phpne, a PHP User Group covering the North-East of England.

  2. #27
    SitePoint Evangelist
    Join Date
    Aug 2005
    Location
    Winnipeg
    Posts
    498
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You should seriously consider using a CMS like Drupal or Joomla or even WordPress (CNN, NYTimes, etc)

    Drupal is what I eventually settled on for projects like these and it's saved me 1000's of hours of boring labour.

    Cheers,
    Alex
    The only constant in software is change itself

  3. #28
    SitePoint Wizard DoubleDee's Avatar
    Join Date
    Aug 2010
    Location
    Arizona
    Posts
    3,756
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by AnthonySterling View Post
    Debbie,

    Let's try and keep your thoughts and questions on this subject in one place, most of these replies could have been avoided if only people had seen your other thread.

    I've merged these threads.

    Anthony.
    I started a new thread because the last one - now this one - was getting no where. (Topless women, code that is over my head, and insistence that I use 3rd party software doesn't help.)

    In my (formerly) new thread I described a really simple example of what I am trying to do, and I already see "Just use Drupal" is creeping back in...


    Debbie

  4. #29
    . shoooo... silver trophy logic_earth's Avatar
    Join Date
    Oct 2005
    Location
    CA
    Posts
    9,013
    Mentioned
    8 Post(s)
    Tagged
    0 Thread(s)
    Using example.tld/index.php?page=about would bring up about's content.

    Code php:
    <?php
     
    // ...output some html content here...
    echo '<body>';
     
    // more html content
     
    // Page specific content:
    switch ( strtolower( $_GET['page'] ) ) {
     
      case 'about':
        // About page content
        break;
     
      default:
        // Home page content
        break;
    }
     
    // More html content
    echo '</body></html>';

    * And yes I did this thing called sleeping thus why my reply is now and wasn't later.
    Logic without the fatal effects.
    All code snippets are licensed under WTFPL.


  5. #30
    dooby dooby doo silver trophybronze trophy
    spikeZ's Avatar
    Join Date
    Aug 2004
    Location
    Manchester UK
    Posts
    13,804
    Mentioned
    157 Post(s)
    Tagged
    3 Thread(s)
    OK I think I get what Debbie is heading towards.

    *drum roll please...* FRAMES!
    A frameset where nothing but the centre frame is reloaded when a link is clicked.....

    HTML Frames Tutorial - HTML Code Tutorial

    Am I on the path Debbie?
    Mike Swiffin - Community Team Advisor
    Only a woman can read between the lines of a one word answer.....

  6. #31
    Twitter: @AnthonySterling silver trophy AnthonySterling's Avatar
    Join Date
    Apr 2008
    Location
    North-East, UK.
    Posts
    6,111
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    If you're getting lost, you should speak up and say so; starting a new thread helps no-one.

    So, is there anything in particular you would like to know/learn about the solution I posted here?

    http://www.sitepoint.com/forums/4839555-post13.html
    @AnthonySterling: I'm a PHP developer, a consultant for oopnorth.com and the organiser of @phpne, a PHP User Group covering the North-East of England.

  7. #32
    SitePoint Wizard DoubleDee's Avatar
    Join Date
    Aug 2010
    Location
    Arizona
    Posts
    3,756
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by SpacePhoenix View Post
    Have you considered having the template as a php file which is basically all HTML with things like user names, page content, page headings, page titles etc echo'd in. Your scripts would generate the various parts and copy them into variables. The template would be included at the end with a number of for example:

    PHP Code:
    <h1><?php echo $main_heading?></h1>
    You would need to have a controlling script(s) which would generate/load the relevant script(s). No javascript needed.
    I'm not really following you...

    The approach I would take is this...

    1.) Wrap my entire static "index.html" code in <php? ?> tags and rename the file "index.php"


    2.) Modify the Menu section to have PHP that provides logic of what content to provide. (Where I am currently stuck!)


    3.) Have additional PHP in the "middle_content" section of my HTML, which will swap in and out the relevant content.

    Code:
    <div id="content">
    	<div id="test">
    		<h2>MAIN CONTENT</h2>
    			<p>
    			SOME PHP TO INCLUDE THE CORRECT CONTENT HERE
    	</div>
    </div>

    Debbie

  8. #33
    SitePoint Wizard DoubleDee's Avatar
    Join Date
    Aug 2010
    Location
    Arizona
    Posts
    3,756
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by AnthonySterling View Post
    If you're getting lost, you should speak up and say so; starting a new thread helps no-one.
    I'm sorry, Anthony, but I'm about in tears over this. (And no one likes to see a grown woman cry...)

    I get so frustrated sometimes by certain people and certain forums. (I guess I have just gotten spoiled working with people like Paul and Rayzur over in the other forums.)

    Nothing gets on my nerves more than when people don't listen and/or repeatedly offer advice I clearly said I'm not interested in!! (e.g. What you need is a CMS system...)

    Off Topic:

    For the record... The reason I don't want to go down the WordPress and SEO-centric path is because...

    1.) Almost none of those people/solutions make $$$
    2.) None of them know how to code or do architecture
    3.) They litter up the forums and Internet with crap
    4.) And those people are the hoi polloi of the world. (Not my scene!!!)



    So, is there anything in particular you would like to know/learn about the solution I posted here?

    http://www.sitepoint.com/forums/4839555-post13.html
    I'd love to learn fancier solutions, but my #1 goal is to get my website up in the next week or so, and have something that is maintainable. THEN, over the next few months, I can go back and read a whole bunch of books on PHP and MySQL and so on and build something beefier.

    If someone will listen to me and work with me, I think a solution will come quickly. But considering that I have forgotten most of my PHP and MySQL skills, that means slowing down. So, object-oriented solutions, database solutions, and radical code solutions wouldn't be a first step. (Maybe in 2.0...)

    ---

    I drove over an hour round-trip last night to a local Barnes & Noble store to try and find a book to help me out. (It was all garbage!)

    Ironically, I think SitePoint's book on "Database-driven websites" would be helpful, but they didn't have the book, and I may be moving here in the next few days, so now is not a good time for that.

    ---

    I'm sorry if I seem dumb to everyone, but there are fundamental things I'm not getting, and I'm pleading with some kind soul to take the time to not go off on tangents, but to listen to me and help me connect the dots.

    That's why people like Paul O'B and Rayzur are the best-of-the-best, because they walk people step-by-step through things until they get every step. ("Wax on... Wax off!")

    If we can start over (in this merged thread), I'm glad to explain where I am stuck and explain how "I" would like to approach things, and I'm sure we can find a solution that works for everyone!

    Fair enough?



    Debbie

  9. #34
    SitePoint Guru aamonkey's Avatar
    Join Date
    Sep 2004
    Location
    kansas
    Posts
    953
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This is about the simplest system I can think of that meets your criteria -

    1) You have one template/controller page that loads the appropriate article/page for the inner content. This is your index.php page and gets called on every request:

    PHP Code:
    <?php                
                        
    if (isset($_GET['page'])) {

        
    $pageFile '/pages/'.$_GET['page'].'.php';
        
        if(
    file_exists($pageFile)) {
            require(
    $pageFile);
        } else {
            
    $title 'Not Found';
            
    $content '';
        }
    } else {
        require(
    '/pages/default.php');
    }


    ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">

    <head>
        <title><?php echo $title?></title>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <link type="text/css" rel="stylesheet" href="css/pagelayout.css">
        <link type="text/css" rel="stylesheet" href="css/dropdown.css">
    </head>

    <body>
        <div id="wrapper" class="clearfix">
            <div id="inner">
                <div id="header">
                    <!-- DROP-DOWN MENU -->
                    <ul id="topMenu">
                        <li class="current"><a href="#">News</a>
                            <ul>
                                <li><a href="#">Breaking</a></li>
                                <li><a href="#">Local</a></li>
                                <li><a href="#">U.S.</a></li>
                                <li><a href="#">World</a></li>
                            </ul>
                        </li>
                        
                        <!--    SNIP    -->
                        
                    </ul>        <!-- END OF HEADER -->

                </div>
                <div id="left">
                    <p>
                        Other content goes here : Other content goes here : Other content goes here :
                    </p>
                </div>
                <div id="middle">
                    <div id="content">
                        <div id="test"><--------------- INDICATES MINIMUM PAGE WIDTH ---------------></div>
                        
                        <?php echo $content?>
                        
                    </div>
                </div>
                <div id="right">
                    <p>
                        Adverting goes here : Adverting goes here : Adverting goes here :
                    </p>
                </div>
            </div>
            <div id="l"></div>
            <div id="r"></div>
            <!-- l & r are the left and right column colours only - they hold no content -->
        </div>
        <div id="footer">
            <p>footer</p>
        </div>
    </body>

    </html>
    2) You place all your articles into a /pages directory.
    e.g. /pages/article1.php

    your pages contain something like this:

    PHP Code:
    <?php

    $title 
    'Title of the page';

    $content '<h2>Article 1</h2>
    <p>some content here</p>'
    ;

    ?>
    3) You create your links like:
    mysite.com/index.php?page=article1
    mysite.com/index.php?page=article2
    etc.

    How does that look?
    aaron-fisher.com - PHP articles and more

  10. #35
    SitePoint Wizard DoubleDee's Avatar
    Join Date
    Aug 2010
    Location
    Arizona
    Posts
    3,756
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    aamonkey,

    Some questions...

    1.) I've seen a lot of solutions where people take a large HTML template and dissect it up into a bunch of includes (e.g. Header, Left Col, Right Col, Footer, etc).

    That seems bass-ackwards.

    From what I recall, it is bad to place large amounts of HTML in an echo statement.

    Agree or disagree?

    (Your code seems consistent with how I would do things.)


    2.) I don't understand how you get the content to appear.

    As your code stands, I don't see where the GET gets any values.


    3.) I don't see how your code knows which content/article to include...

    You have this code...

    Code:
    <?php echo $content; ?>
    but how does that relate to your beginning PHP code?



    Debbie
    Last edited by DoubleDee; Mar 23, 2011 at 12:23. Reason: Found another question...

  11. #36
    SitePoint Evangelist
    Join Date
    Aug 2005
    Location
    Winnipeg
    Posts
    498
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    In my (formerly) new thread I described a really simple example of what I am trying to do, and I already see "Just use Drupal" is creeping back in...
    Sorry I only suggested going with Drupal because your requirements of having a content heavy site (CNN, NYTimes, etc) in a novice designed/developed bespokse software system are realistic.

    You could use Smarty or similar template engine to form the master layout and channel all requests through a single index.php and select the required content pages/sub-layouts but your application will quickly turn into a massive headache and you will begin looking for solutions like Drupal anyways. Figured I'd save you what I learned the hard way

    If you had said you were interested in learning progressively, I would likely have provided more detailed answers.

    I implemented a simple CMS a few years ago to meet these requirements:

    TexoCMS | Download TexoCMS software for free at SourceForge.net

    It's a solution such as what you seek. You have a master template and a content section. I believe you can toggle the templates (if memory serves me correctly). All with the added bonus of having a CMS backend to easily allow you to change content, etc.

    Its a hack, a really bad one in fact, but it's the simplest/complete example I could think of to get you started.

    p.s-Just to re-iterate...you would be much better off using a DB powered system like drupal and investing the time learning a system that will allow you to expand/scale and grow not quickly hit a road block and force you to hire a developer(s) to correct your situation at a later date.

    Cheers,
    Alex
    The only constant in software is change itself

  12. #37
    SitePoint Guru aamonkey's Avatar
    Join Date
    Sep 2004
    Location
    kansas
    Posts
    953
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by DoubleDee View Post
    aamonkey,

    Some questions...

    1.) I've seen a lot of solutions where people take a large HTML template and dissect it up into a bunch of includes (e.g. Header, Left Col, Right Col, Footer, etc).

    That seems bass-ackwards.

    From what I recall, it is bad to place large amounts of HTML in an echo statement.

    Agree or disagree?
    It's not bad, but it can make it harder to read. This is just a very basic example, there are lots of ways to tweak this. If you don't want to store the html in a variable there are many other solutions.


    Quote Originally Posted by DoubleDee View Post
    2.) I don't understand how you get the content to appear.

    As your code stands, I don't see where the GET gets any values.
    $_GET['page'] would return the value of the 'page' variable in the query string. So if you call your pages like:
    Code:
    mysite.com/index.php?page=article1
    $_GET['page'] would return the value 'article1'. Then you name one of your files article1.php, and the $_GET['page'] variable is used to request the correct template file.


    Quote Originally Posted by DoubleDee View Post
    3.) I don't see how your code knows which content/article to include...

    You have this code...

    Code:
    <?php echo $content; ?>
    but how does that relate to your beginning PHP code?
    The $content (as well as $title) variables will always be set in the included file (in this example, 'article1.php'). When you include a php file within another php file, all the variables defined in the include become available to the calling script. In other words:

    1) index.php includes /pages/article1.php
    2) /pages/article1.php has $content and $title variables set
    3) These variables now exist in index.php
    aaron-fisher.com - PHP articles and more

  13. #38
    SitePoint Wizard DoubleDee's Avatar
    Join Date
    Aug 2010
    Location
    Arizona
    Posts
    3,756
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by PCSpectra View Post
    Sorry I only suggested going with Drupal because your requirements of having a content heavy site (CNN, NYTimes, etc) in a novice designed/developed bespokse software system are realistic.
    Maybe, but it sorta takes the fun out of learning to build your own website from scratch.

    (You could pay a stranger on another continent to get pregnant for you, raise this pseudo-child for you, and send a picture each year of how things are going, but then that wouldn't exactly be having and raising you own child, now would it?!)


    You could use Smarty or similar template engine
    Have you ever looked at the source-code for Smarty?

    If I have ever seen an example of HORRENDOUS coding and patch-work, it has to be Smarty.



    to form the master layout and channel all requests through a single index.php and select the required content pages/sub-layouts but your application will quickly turn into a massive headache and you will begin looking for solutions like Drupal anyways. Figured I'd save you what I learned the hard way
    Well, if you would have said that in the beginning, instead of getting annoyed with a suggestion that I wasn't interested in, it would have started a good conversation - which I'm pretty good at accomplishing so far on SitePoint.

    Do I want someone else's software/solution? NO!!

    Do I want to build my own home-grown train-wreck? NO!!

    Am I looking to tap into all of the knowledge here at SitePoint? Yes!

    Do I need people to be patient and let me take baby steps until I get up to speed? Yes.

    So, I just modified aamonkey's example, and got something *really crude* working... (I'll post it in another post.)


    If you had said you were interested in learning progressively, I would likely have provided more detailed answers.
    Sorry, that is the problem not knowing me and being on the Internet.

    (I *need* mentor who will go slow and help me meet my immediate goals, but I also totally want to be a super-PHP-ninja some day!! HI-YAH!!!!)


    Off Topic:

    My website could likely become as big as the NY Times, however unlike the NY Times, I don't want to build a piece of crap that follows no logical coding standards, has poor organization, is not accessible, and was written by Dreamweaver jockeys...

    (Just ask DeathShadow what he thinks about most online newspapers...)



    I implemented a simple CMS a few years ago to meet these requirements:

    TexoCMS | Download TexoCMS software for free at SourceForge.net

    It's a solution such as what you seek. You have a master template and a content section. I believe you can toggle the templates (if memory serves me correctly). All with the added bonus of having a CMS backend to easily allow you to change content, etc.

    Its a hack, a really bad one in fact, but it's the simplest/complete example I could think of to get you started.
    Well, not to not take advantage of your project, but can't we talk about it here in baby pieces?

    I'm not ready for a full-fledged CMS. I just need an easy way to keep my templates separate from my content.

    As it stands, I really only have two temples: "Home Page template" (3-column design) and "Content template" (2-column design). To get my site up and running and keep it running, just being able to go write an article and then link it to either template so it magically appears in its proper place, and doesn't mess with my beautiful templates would be golden.

    Do I ultimately need more than that. Sure. But my customers only care that my website looks professional, and that it has new and interesting content on a regular basis! So one step at a time...


    p.s-Just to re-iterate...you would be much better off using a DB powered system like drupal and investing the time learning a system that will allow you to expand/scale and grow not quickly hit a road block and force you to hire a developer(s) to correct your situation at a later date.
    Okay, but...

    1.) Is Drupal going to let me use *my* templates as is?

    2.) I bet learning Drupal could take weeks if not months. (Technically the sample I just put together will do enough to get me going for the next month. *With a little more help!*)

    3.) I learn best through *doing*. I tend to get really lost, really quick following other people's work and code. (It is why I could never work as a developer on a team. It is just too hard for me to jump into otehr people's code and pick up.)

    When I was getting help learning HTML and CSS basics, I built a lot of things that I through away, but guess what, I learned sooo much more that way!

    All good suggestions, but hopefully you see my points too!



    Debbie

  14. #39
    SitePoint Wizard DoubleDee's Avatar
    Join Date
    Aug 2010
    Location
    Arizona
    Posts
    3,756
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by spikeZ View Post
    OK I think I get what Debbie is heading towards.

    *drum roll please...* FRAMES!
    In 1995, yes. In 2011, umm... no!


    Am I on the path Debbie?
    Below is what I have come up with so far. (It is basically aamonkey's code...)

    No laughing!!!!

    Code HTML4Strict:
    <?php
    	if (isset($_GET['article'])) {
     
    			$articleFile = $_GET['article'].'.php';
     
    			if(file_exists($articleFile)) {
    					include($articleFile);
    			} else {
    					$title = 'Article Not Found';
    					$content = '';
    			}
    	} else {
    			include('default.php');
    	}
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
     
    <head>
    	<title>Dynamic Content Example</title>
    	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    	<link type="text/css" rel="stylesheet" href="css/pagelayout.css">
    	<link type="text/css" rel="stylesheet" href="css/dropdown.css">
    </head>
     
    <body>
    	<div id="wrapper" class="clearfix">
    		<div id="inner">
    			<div id="header">
    				<!-- DROP-DOWN MENU -->
    				<ul id="topMenu">
    					<li class="current"><a href="?article=article1">Article 1</a></li>
    					<li><a href="?article=article2">Article 2</a></li>
    					<li><a href="?article=article3">Article 3</a></li>
    					<!-- and so on... -->
    				</ul><!-- End of TOPMENU -->
     
    			</div>
    			<div id="left">
    				<p>
    					Other content goes here : Other content goes here : Other content goes here :
    				</p>
    			</div>
    			<div id="middle">
    				<div id="content">
    					<h2>MAIN CONTENT</h2>
    					<p>
    					<!-- Dynamically insert Article here using PHP include!! -->
    					<?php echo $content; ?>
    					</p>
    				</div>
    			</div>
    			<div id="right">
    				<p>
    					Adverting goes here : Adverting goes here : Adverting goes here :
    				</p>
    			</div>
    		</div>
    		<div id="l"></div>
    		<div id="r"></div>
    	</div>
    	<div id="footer">
    		<p>footer</p>
    	</div>
    </body>
     
    </html>


    PHP Code:
    <?php
        $title 
    'You are reading Article 1';

        
    $content '
            <h2>Article 1</h2>
            <p>This is Article 1...</p>'
    ;
    ?>
    and so on...



    Debbie

  15. #40
    SitePoint Guru aamonkey's Avatar
    Join Date
    Sep 2004
    Location
    kansas
    Posts
    953
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    looks good to me - but what do you think about that system? Do you think that's going to get you where you need?
    aaron-fisher.com - PHP articles and more

  16. #41
    Twitter: @AnthonySterling silver trophy AnthonySterling's Avatar
    Join Date
    Apr 2008
    Location
    North-East, UK.
    Posts
    6,111
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Don't forget to filter the incoming page variable.

    Code:
    index.php?page=../../../../../../../../etc/passwd
    @AnthonySterling: I'm a PHP developer, a consultant for oopnorth.com and the organiser of @phpne, a PHP User Group covering the North-East of England.

  17. #42
    SitePoint Wizard DoubleDee's Avatar
    Join Date
    Aug 2010
    Location
    Arizona
    Posts
    3,756
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by aamonkey View Post
    looks good to me - but what do you think about that system? Do you think that's going to get you where you need?
    Can I have at least 5 minutes of "after-glow", please?!

    Um, hell no!!

    (The rumbling you hear and feel is everyone on SitePoint laughing at my stab at this!)


    Allow me to explain where I see things going...

    In like the next week, I need to get something up online.

    My home page will look like this (Debbie's Test Site) but much more professional. (Sorry, can't let all of the cats out of the bag!)

    Thanks to lots of people on SitePoint, I have just about everything I need to make a really awesome looking home page. And there won't be a lot of content to update there.

    What I do need to improve is how my Top Menu sends people to articles.

    My "Article Template" is basically done, and is really just my home page minus the Left Column to give me more room.

    For Website v1.0 I am envisioning this...

    - If a user clicks on a "Main Category" in the Top Menu and you go to a "Category Landing Page" (e.g. Business home). On that page will be a listing of articles (have another awesome template for this).

    - If a user clicks on a "Sub-Category" (e.g. Business>>Job Listing) then it will either take them to another "landing page" or it will take them directly to an article.

    So all I really need is a way to swap articles in and out of these templates...

    Off Topic:

    If you get rid of all of the advertising and junk that pollutes most corporate websites, things are really pretty simple. You have a header section that usually has navigation, maybe a side column with important issues/items, and then a main content area. Right?!


    I have lots more questions and comments, but what do you think?

    Thanks,



    Debbie

  18. #43
    SitePoint Wizard DoubleDee's Avatar
    Join Date
    Aug 2010
    Location
    Arizona
    Posts
    3,756
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by AnthonySterling View Post
    Don't forget to filter the incoming page variable.

    Code:
    index.php?page=../../../../../../../../etc/passwd
    Sorry, *security* is another topic!


    Debbie

  19. #44
    SitePoint Guru aamonkey's Avatar
    Join Date
    Sep 2004
    Location
    kansas
    Posts
    953
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by AnthonySterling View Post
    Don't forget to filter the incoming page variable.

    Code:
    index.php?page=../../../../../../../../etc/passwd

    absolutely - good point.
    aaron-fisher.com - PHP articles and more

  20. #45
    dooby dooby doo silver trophybronze trophy
    spikeZ's Avatar
    Join Date
    Aug 2004
    Location
    Manchester UK
    Posts
    13,804
    Mentioned
    157 Post(s)
    Tagged
    3 Thread(s)
    Quote Originally Posted by DoubleDee View Post
    In 1995, yes. In 2011, umm... no!
    2011 - Facebook ditch FBML and switch too....... iFrames
    Mike Swiffin - Community Team Advisor
    Only a woman can read between the lines of a one word answer.....

  21. #46
    SitePoint Wizard DoubleDee's Avatar
    Join Date
    Aug 2010
    Location
    Arizona
    Posts
    3,756
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by spikeZ View Post
    2011 - Facebook ditch FBML and switch too....... iFrames
    This is a *family-based* website. Can we keep the dirty words (e.g. FaceBook) out of this??

    (There is nothing that Mark Zuckerberg or Facebook has done, does, or will do that I would *ever* aspire towards...)


    Debbie

  22. #47
    SitePoint Wizard DoubleDee's Avatar
    Join Date
    Aug 2010
    Location
    Arizona
    Posts
    3,756
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Okay, so thanks to aaMonkey, I figured out how to use PHP to swap-in/out articles.

    Now some more questions...

    1.) For a basic website, is this okay? Or am I creating a disaster?


    2.) How does this approach change with have a Main Menu and Sub-Menu?


    3.) What could I do to take the next (baby) step and improve things?


    I welcome comments and feedback on what I have so far!!

    Thanks,


    Debbie

  23. #48
    SitePoint Guru aamonkey's Avatar
    Join Date
    Sep 2004
    Location
    kansas
    Posts
    953
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by DoubleDee View Post
    3.) What could I do to take the next (baby) step and improve things?
    You can go ahead and plug that security hole that Anthony mentioned - just swap out this line:
    PHP Code:
    $articleFile $_GET['article'].'.php'
    with this:

    PHP Code:
    $articleFile preg_replace('#[^\w\-]#'''$_GET['article']).'.php'
    aaron-fisher.com - PHP articles and more

  24. #49
    SitePoint Wizard DoubleDee's Avatar
    Join Date
    Aug 2010
    Location
    Arizona
    Posts
    3,756
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by aamonkey View Post
    You can go ahead and plug that security hole that Anthony mentioned - just swap out this line:
    PHP Code:
    $articleFile $_GET['article'].'.php'
    with this:

    PHP Code:
    $articleFile preg_replace('#[^\w\-]#'''$_GET['article']).'.php'
    What does that do/say? (I'm not so great with regular expressions.)

    And what about my larger questions/goal?

    Is the example you helped me with really so bad?

    And how is it different t=from this never-ending beat of "You need a CMS!"??

    Since I am not the NY Times, swapping in/out hundreds of articles a day, don't you think this is all I need for now?


    Debbie

  25. #50
    SitePoint Guru aamonkey's Avatar
    Join Date
    Sep 2004
    Location
    kansas
    Posts
    953
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by DoubleDee View Post
    What does that do/say? (I'm not so great with regular expressions.)
    It removes everything that is not a letter, number, underscore, or dash from the $_GET['article'] variable.

    Quote Originally Posted by DoubleDee View Post
    And what about my larger questions/goal?

    Is the example you helped me with really so bad?

    And how is it different t=from this never-ending beat of "You need a CMS!"??

    Since I am not the NY Times, swapping in/out hundreds of articles a day, don't you think this is all I need for now?
    The nice thing about php is there are 500 ways to skin a cat. IMO what you have is a simple, but solid solution to your problem. It's hard to say if it will meet all your needs in the future, but it gets you on the right path. Should you need to change how you do things in the future, it allows an easy upgrade path since the page titles and contents are stored in php variables. i.e. if you discovered you needed to switch to a CMS or something it would be easy to pull the contents of the different pages during migration.
    aaron-fisher.com - PHP articles and more


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •