Welcome, Guest. Register Now!
   
Mark Forums Read Mark Forums Read Mark Forums Read


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-19-2008, 03:07 AM
Junior Member
 
Join Date: May 2008
Posts: 8
Default Stange behavier, cant view anything else than index page

Hi, Im stugling with a strange behavier her.
When I go to http://localhost:8080/no/part2/html/index.php I get the index.phtml rendered as i should. If I go to another adress (http://localhost:8080/no/part2/appli...Controller.php) during a post from a form, I only get a emty page, not Transfere.phtml rendered.

Any Ide about this error? Driving me crazy here ...

My .htaccess fil:
Code:
RewriteEngine on
RewriteBase /
RewriteRule !\.(js|ico|txt|gif|
I would also like to know if it is normal that any code from Zend comes AFTHER the </html> tag in the source, even if it was intended in the <body> tag when echoed out in the .phtml file..

From IE source:
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN">
<html>
<head>
<meta http-equiv="Content-Type" type="text/html; charset=UTF-8">
<script type="text/javascript">
function button_pressed(){
alert("knapp trykket");
test = getElementById("tekstboks");
alert(test);
}
</script>
<title>Test av rammeverk nummer 2</title>
</head>

    <body>
    <h1 style="background: blue; color: white;">Her skal du leke litt med de ulike kontrollene og se om responstiden er bra nok. Husk at layout ikke har noe med denne testen 㟧j�.
    
    </h1>
	<p>
		</p>
	<div id = "done" name = "done"></div>
		<p>
		</p>
	<p>
	
		</p>
	</br>
	    </body>
  
</html></br></br><form id="stdkontroller1" enctype="application/x-www-form-urlencoded" action="http://localhost:8080/no/part2/application/default/controllers/TransfereController.php" method="post"><dl class="zend_form">
<dt><label for="tekstboks" class="optional">Skriv inn en tekst i tekstboksen:</label></dt>
<dd>
<input type="text" name="tekstboks" id="tekstboks" value=""></dd>
<dt></dt><dd>
<input type="submit" name="Sendtillistboks" id="Sendtillistboks" value="Send til listboks"></dd>
<dt></dt>
<dd>
<select name="listboks" id="listboks" label="Listeboks: " size="5">
    <option value="0" label="Valg 1">Valg 1</option>
    <option value="1" label="Valg 2">Valg 2</option>
</select></dd></dl></form><form id="stdkontroller2" enctype="application/x-www-form-urlencoded" action="http://localhost:8080/no/part2/application/default/controllers/TransfereController.php" method="post"><dl class="zend_form">
<dt></dt>
<dd>
<label style="white-space: nowrap;"><input type="checkbox" name="groups[]" value="1">Valg 1</label><br /><label style="white-space: nowrap;"><input type="checkbox" name="groups[]" value="2">Valg 2</label><br /><label style="white-space: nowrap;"><input type="checkbox" name="groups[]" value="3">Valg 3</label></dd></dl></form><form id="stdkontroller3" enctype="application/x-www-form-urlencoded" action="http://localhost:8080/no/part2/application/default/controllers/TransfereController.php" method="post"><dl class="zend_form">
<dt></dt>
<dd>
<label style="white-space: nowrap;"><input type="radio" name="valg" value="0">Valg1</label><br /><label style="white-space: nowrap;"><input type="radio" name="valg" value="1">Valg 1</label></dd></dl></form>
My index.phtml content:
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN">
<html>
<head>
<meta http-equiv="Content-Type" type="text/html; charset=UTF-8">
<script type="text/javascript">
function button_pressed(){
alert("knapp trykket");
test = getElementById("tekstboks");
alert(test);
}
</script>
<title>Test av rammeverk nummer 2</title>
</head>

    <body>
    <h1 style="background: blue; color: white;">Her skal du leke litt med de ulike kontrollene og se om responstiden er bra nok. Husk at layout ikke har noe med denne testen å gjøre ..
    
    </h1>
	<p>
	<?php  $this->form1; ?>
	</p>
	<div id = "done" name = "done"></div>
		<p>
	<?php $this->form2;  ?>
	</p>
	<p>
	
	<?php  $this->form3; ?>
	</p>
	</br>
	<?php $this->viewText; ?>
    </body>
  
</html>

Last edited by Aurheim : 05-19-2008 at 03:10 AM. Reason: added source from IE
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 05-19-2008, 06:24 PM
Junior Member
 
Join Date: Mar 2008
Posts: 26
Default

omg Aurheim please read anything about Zend Framewrok on maunual or any other tuturial. You are asking about such trivial question that it drives me crazy.

My propostition is very simple - read something about client side of application (html, javascript), basics of php and design patters (including MVC), mod_rewrite, and only then ZF. You are definetely trying to do things that are too hard for you.

However, I am helpful person so I'l try to answer your questions.

1. First of all, looking at the links you're accessing - configure your web server root to html directory, or make the structure as follows (it is not required but maybe it will help you):

Code:
+application
   bootstrap.php
   +modules
      +default
         +controllers
            IndexController.php
            TransfereController.php
            ...
         +models
         +views
            +index // IndexController
               index.phtml // IndexController:indexAction()
               test.phtml // IndexController:testAction()
            +transfere
               index.phtml // TransfereController:indexAction()
               other.phtml // TransfereController:otherAction()
      +someothermodule
   +configs
   ...
+library
   +Zend
   ...
+public
   +css
   +js
   +images

index.php // require_once '../application/bootstrap.php';
.htaccess // RewriteEngine On
                 !\.(js|ico|gif|jpg|png|css)$ index.php
As you can see the main difference is that index.php is no longer in html folder.

now if you go to http://localhost/app/, IndexController and indexAction() from default module is accessed. application/modules/default/index/index.phtml

Code:
http://localhost/app/index => IndexController:indexAction() application/modules/default/index/index.phtml

http://localhost/app/index/index => IndexController:indexAction() application/modules/default/index/index.phtml

http://localhost/app/index/test => IndexController:testAction() application/modules/default/index/test.phtml

http://localhost/app/transfere => TransfereController:indexAction() application/modules/default/transfere/index.phtml

http://localhost/app/transfere/other => TransfereController:otherAction() application/modules/default/transfere/other.phtml

http://localhost/app/someothermodule/index/index => Someothermodule_IndexController:indexAction() application/modules/someothermodule/index/index.phtml
2. I really can't see where does the problem with rendering comes from. I can only think of this situation:

In controller you propably write:
PHP Code:
echo $form1;
echo 
$form2;
echo 
$form3
Am I right?
However, You should type in
PHP Code:
$this->view->form1 $form1;
$this->view->form2 $form2;
$this->view->form3 $form3
In conclusion, this may help you. However, you are "obliged" to get some further information on topics I listed in the beginning. I strongly encourage you to do some easier things (do you really need the functionality ZF provides ??)

Last edited by kuba : 05-19-2008 at 07:05 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 05-19-2008, 09:43 PM
Junior Member
 
Join Date: May 2008
Posts: 8
Default re

Thanks for the reply.

I do have read a lot about it, and have seen several hours of video about it. The problem is that there always are some small bits missing or just not explained good enough in the tutorials and manuals. This is probably the best explination that I have seen so far for the folder/namingconvention.

The problem with the view was that I missunderstood the namingconvention about the .pthm files.

+transfere
index.phtml // TransfereController:indexAction()
other.phtml // TransfereControllertherAction()
became

+transfere
transfere.phtml // TransfereController:indexAction()
other.phtml // TransfereControllertherAction()

and would of cource not render. To bad nobody illustrated the folder/file tree as you did here before. Would have saved me some hours spent researching. Since I did not have any proof of the environment working as it should, it was easy to suspect some configuration error when the resulting html did not follow the standard outline.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 05-19-2008, 10:58 PM
sim sim is offline
Junior Member
 
Join Date: Apr 2008
Posts: 9
Default

I would also like to know if it is normal that any code from Zend comes AFTHER the </html> tag in the source, even if it was intended in the <body> tag when echoed out in the .phtml file.

Definitely no. When you use the forms:

<?php $this->form1; ?>
<?php $this->form2; ?>
<?php $this->form3; ?>


It appears that you are trying to use View Helper classes that echo output within the helper class. It would be better to return the helper text to the view script and echo it there:

<?php echo $this->form1; ?>

Or insert the form data into the View, like Kuba mentioned:

$this->view->form1 = $form1;

+transfere
index.phtml // TransfereController:indexAction()
other.phtml // TransfereControllertherAction()


index.phtml is the default view when no action is specified for the controller. I believe that is the case for all controllers unless you specifically change the controllers behavior.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 05-20-2008, 05:53 AM
Junior Member
 
Join Date: Mar 2008
Posts: 26
Default

you can read more about Choosing Your Application's Directory Layout at Choosing Your Application's Directory Layout - Zend Framework Wiki and Zend Framework Default Project Structure - Wil Sinclair - Zend Framework Wiki
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 04:27 PM.