Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 524073
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T08:31:46+00:00 2026-05-13T08:31:46+00:00

I’ve been working with a developer on a web-based application. I have some experience

  • 0

I’ve been working with a developer on a web-based application. I have some experience with html and css mainly, and now that the heavy lifting is done, I’m wanting to start improving the design elements of the program (I know that is NOT the ideal situation, and in a perfect world, all design elements would have been considered from the beginning-but those of you that work on projects know that it doesn’t always go that way 😀 )

I’m curious if there is a “standard” way that css and general layout structure is handled when working with extensive PHP conditionals. Here is an example of one area of our page:

$print_data .= '<p><b>My subscription:</b>&nbsp;&nbsp;';

if($period3=="1 M") {
  $print_data .= "$".$amount3." a month.<br />";
  $print_data .= "<b>Billing date:</b>&nbsp;&nbsp; Monthly on the " . date("jS", $subscr_effective_date_string) .".<br /><br /><b>Modification Options:</b><br />";
  $print_data .= '<input type="button" value="$75 every 6 months" onclick="#" /><br />
 <input type="button" value="$135 every 12 months" onclick="#" /><br /><br />';
}

elseif($period3=="6 M") {
  $print_data .= "$".$amount3." every 6 months.<br />";
  $print_data .= "<b>Billing date:</b>&nbsp;&nbsp; Every 6 months on " . date("m/d", $subscr_effective_date_string) ." and " . date("m/d",$subscr_effective_date_add_6mo_string) .".<br /><br /><b>Modification Options:</b><br />";
  $print_data .= '<input type="button" value="$14 a month" onclick="#" /><br /><input type="button" value="$135 every 12 months" onclick="#" /><br /><br />';
}

elseif($period3=="1 Y") {
  $print_data .= "$".$amount3." every year.<br />";
  $print_data .= "<b>Billing date:</b>&nbsp;&nbsp; Yearly on the " . date("m/d", $subscr_effective_date_string) .".<br /><br /><b>Modification Options:</b>";
  $print_data .= '<input type="button" value="$14 a month" onclick="#" /><br /><input type="button" value="$75 every 6 months" onclick="#" /><br /><br />';
}

$print_data .= '<input type="button" value="Unsubscribe" onclick="#" /></p>';

So in short, I’m wanting to contain the above in a <ul> and then have each conditional be a separate <li> group that will populate the <ul> depending on the condition.

Is this sort of thing just usually all handled in-line, or what?

Thanks!
Joel

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T08:31:47+00:00Added an answer on May 13, 2026 at 8:31 am

    Uf, that’s ugly. That’s pretty much the reason web development has been moving to a Model-View-Controller (MVC) approach over the last few years. Ideally your presentation markup (the html tags in your soup above) would be in one file and the logic that populates it in another file. One of the most common ways to do this in PHP is to use the Smarty templating engine.

    In the interim, at the very least, the code above should be cleaned up: figure out the values for $amount3 and the text that goes on the billing input button and then just output the HTML in one place, rather than repeating it for each case (and it would be nice to use sprintf instead of jamming the strings together for cleanliness and a bit of added security).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 448k
  • Answers 448k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Look at table 7-1 of the docs. There are events… May 15, 2026 at 8:02 pm
  • Editorial Team
    Editorial Team added an answer If you are asking if you can programmatically control arbitrary… May 15, 2026 at 8:02 pm
  • Editorial Team
    Editorial Team added an answer Make the id column in MySQL AUTO_INCREMENT so the id… May 15, 2026 at 8:02 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.