Link to home
Start Free TrialLog in
Avatar of Marthaj
MarthajFlag for United States of America

asked on

Symfony 1.1.7 page not displaying the css

I am working on s Symfony 1.1.7 legacy application in localhost. I have a page, admin.php, that does display the input boxes/buttons correctly but does not display it using the css for it. I find the css page in the folder web/css/admin.css . 

This is the page being executed. It is located under the web folder .i.e. www.doghomes.com/web folder. It contains this:

<?php
// Hack to correct server SCRIPT_NAME
$_SERVER['SCRIPT_NAME'] = '/' . ltrim(str_replace($_SERVER['DOCUMENT_ROOT'], '/', $_SERVER['SCRIPT_FILENAME']), '/');

require_once(dirname(__FILE__).'/../config/ProjectConfiguration.class.php');
$configuration = ProjectConfiguration::getApplicationConfiguration('admin', 'prod', false);
sfContext::createInstance($configuration)->dispatch();

Open in new window

Under the www.doghomes.com/apps/admin/config, this is the routing.yml:


# default rules
homepage:
  url:   /
  param: { module: homepage, action: index }

default_symfony:
  url:   /symfony/:action/*
  param: { module: default }

default_index:
  url:   /:module
  param: { action: index }

default:
  url:   /:module/:action/*

 sf_guard_signin:
  url:   /login
  param: { module: sfGuardAuth, action: signin }
 
sf_guard_signout:
  url:   /logout
  param: { module: sfGuardAuth, action: signout }
 
sf_guard_password:
  url:   /request_password
  param: { module: sfGuardForgotPassword, action: password }

Open in new window

And this is the view.yml:


default:
  http_metas:
    content-type: text/html

  metas:
    title:        Doghomes Admin
    #robots:       index, follow
    #description:  symfony project
    #keywords:     symfony, project
    language:     en

  stylesheets:    [ admin ]

  #javascripts:    [ prototype/js/prototype.js, suckerfishIeHack ]
  javascripts:    [ suckerfishIeHack ,  jquery.1.3.2.min.js ]


  has_layout:     on
  layout:         layout

Open in new window

Any help appreciated.


Avatar of Scott Fell
Scott Fell
Flag of United States of America image

What you want to look at is the rendered page. Open the page in the browser, hit f12 and see what errors you are getting. You are probably not loading the CSS file. Make sure you are reacing the directories you think you are. Test that first bit of code you have to see if they are producing the correct URLs.  Also, can't reach doghomes.com from the outside. Does that have anything to do with it?

Avatar of Marthaj

ASKER

Thank you for responding. You won't be able to reach the website via Internet as I am loading in 'localhost' mode which should be fine. Previous developers were Windows based using Virtual Machine with Vagrant for developing,testing and staging. Unfortunately the info is scanty at best and outdated. It is a Symfony 1.1.7 legacy application, Ubuntu OS and I have loaded all the necessary supporting software, i.e.PHP, Mysql etc  matching the versions.
I had already used F12 and it shows is looking for:
 
http://www.doghomes.com/css/admin.css

Open in new window


It also cross domains to the original website, which I have loaded also and have enabled. They are both residing on the same computer and I would think that would be fine. It mainly references the original app for such things as site content, testimonials and so forth. I can see the reasoning for that approach particularly since it has a bit of different function then the website that I am trying to get correctly loaded and up and running so changes can be made.

http://www.doghomes.com/css/admin.css


That's your issue.  The css is trying to access doghomes.com which is turned off at the moment.  Update your code so you are using the current domain the site is running on.  In your template, if you have the CSS 


<link href="http://www.doghomes.com/css/admin.css" rel="stylesheet" type="text/css" />

Open in new window


Change it to


<link href="/css/admin.css" rel="stylesheet" type="text/css" />

Open in new window


Or use a variable in place of the www.doghomes.com that reflects the current domain.




Avatar of Marthaj

ASKER

Thank you for responding. Sorry for the delay in responding.
The current site is www.doghomes.com - localhost mode  - and is enabled.
The template does not a have  css link and adding it did not help.
I have no clue how/where they are calling it. Any idea ?? I would have thought it would have been included in the layout. Which I tried and results are the same. It stills shows the same.
This is confusing.

When you use the F12 and click on the console tab, are you getting any errors? That is where you would start.  My suspicion is you are getting a 40x error, perhaps for not found, not allowed etc. 


If you add http://www.doghomes.com/css/admin.css  to your browser, can you serf to it? what error do you get? Are there other CSS files showing an error in the browser console (F12)?

Avatar of Marthaj

ASKER

Thank you for responding.   No errors when I press F12 .
Yes, if I type in http://www.doghomes.com/css/admin.css - it displays the contents of the css page.
And no, no other css pages showing errors.
I think I found the module it is in, but I have no clue why it fails to use it.
Here is the module:

<?php
// auto-generated by sfViewConfigHandler
// date: 2023/02/12 21:11:39
$response = $this->context->getResponse();
  $templateName = sfConfig::get('symfony.view.'.$this->moduleName.'_'.$this->actionName.'_template', $this->actionName);
  $this->setTemplate($templateName.$this->viewName.$this->getExtension());

  if (!is_null($layout = sfConfig::get('symfony.view.'.$this->moduleName.'_'.$this->actionName.'_layout')))
  {
    $this->setDecoratorTemplate(false === $layout ? false : $layout.$this->getExtension());
  }
  else if (is_null($this->getDecoratorTemplate()) && !$this->context->getRequest()->isXmlHttpRequest())
  {
    $this->setDecoratorTemplate('' == 'layout' ? false : 'layout'.$this->getExtension());
  }
  $response->addHttpMeta('content-type', 'text/html', false);
  $response->addMeta('title', 'Doghomes Admin', false, false);
  $response->addMeta('language', 'en', false, false);

  $response->addStylesheet('admin', '', array ());
 
  $response->addJavascript('suckerfishIeHack', '', array ());
  $response->addJavascript('jquery.1.3.2.min.js', '', array ());

Open in new window


I think this is the problem:
$response->addStylesheet('admin', '', array ());

Open in new window


So I changed and this is what the page soure displayed and no errors

<link rel="stylesheet" type="text/css" media="screen" href="/css/www.doghomes.com/web/css/admin.css" />

Open in new window


This tells me where I changed it at was not the right place. Looking again.
Avatar of Marthaj

ASKER

When i enter the address:

http://www.doghomes.com/css/admin.css  

Open in new window


No, it does  not display.

I am confused. At the top of your previous comment, you said


Yes, if I type in http://www.doghomes.com/css/admin.css - it displays the contents of the css page. 


That means it is not an issue.


 I changed and this is what the page soure displayed and no errors


<link rel="stylesheet" type="text/css" media="screen" href="/css/www.doghomes.com/web/css/admin.css" />

Open in new window


That would not be correct. The reason is your the top level folder of your website is probably www.doghomes.com/web.


Before you try and identify what is wrong with the back end code (PHP), we first need to identify what is wrong with the front end (the rendered HTML, CSS and Javascript).


Let's go back to what your original problem is


I have a page, admin.php, that does display the input boxes/buttons correctly but does not display it using the css for it.


Let see a screenshot and then render HTML (right click -> inspect) just for that bit of HTML. What do you have now vs what is it supposed to look like? What we need to look for are what classes are associated with that. Then you need to determine which CSS file is being used. Is it in fact admin.css? And if it is, originally you said http://www.doghomes.com/css/admin.css shows the CSS page. That means there is not an issue with the CSS loading and instead there is an issue with how you are targeting the html.


In order to make this easy for us to help you, create just the small part of HTML you are trying to target on https://codepen.io/ and add the CSS. Let's see what you are working with. 




Avatar of Marthaj

ASKER

Thank you for responding.
Scott - I apologize for the confusion. I will post what you ask for later today.
I have to shut-down because of electric company working on lines. :(
Avatar of Marthaj

ASKER

Is this what you are seeking? As you can see, I can display the css file by entering http://www.doghomes.com/css/admin.css in the browser bar.
And it is the correct css page.
I am thinking it has something to do with the routing.yml but I can not find the problem.
Screenshot-from-2023-02-17-18-24-59.png
Screenshot-from-2023-02-17-18-30-47.png

I still don't know what the issue is.


Go ahead and build a working example in codepen.  Copy that rendered HTML (there is nothing secret there) and then  copy and paste the pertantant css to the CSS area.


Also, include a screen shot of what you are seeing and explain what we should see.

Avatar of Marthaj

ASKER

Thank you for responding. Scott, it's odd. I am confident as to my environment - very scanty info for any incoming developer.
 What is codepen ?
ASKER CERTIFIED SOLUTION
Avatar of Scott Fell
Scott Fell
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Marthaj

ASKER


Thank you for responding. The client isn't going to allow posting code to a codepen so I guess I am just stuck.
I would want to post more code than what I have because I think it might help but has sensitive info.
So I am closing this question out.

Can you recreate the login page and use different information?  There is nothing here https://filedb.experts-exchange.com/incoming/2023/02_w07/1612320/Screenshot-from-2023-02-17-18-24-59.png that I can see that is identifiable to whatever you are working on?  Or if you can just post that portion here by viewing the source it would not be seen outside of EE members.