Keyword

Problems with creating new view for K2.

  • Corinthian
  • Corinthian's Avatar Topic Author
  • Offline
  • New Member
More
13 years 9 months ago #91739 by Corinthian
Problems with creating new view for K2. was created by Corinthian
Hello, everyone. I'm trying to create new view for K2 component, based on "latest" view. I created folder "my_view" in /components/com_k2/views/ and copied there all files from /components/com_k2/views/latest/. I edited those files and added "my_view.php" to /components/com_k2/controllers/. Please tell me, if I did something wrong or missed some steps, because my view isn't working.

 

P.S. Sorry if my English is not very good.

Please Log in or Create an account to join the conversation.

More
13 years 9 months ago #91740 by Mike Oles
Replied by Mike Oles on topic Problems with creating new view for K2.
Did you rename your files in the my_view folder?

 

From latest.php to my_view.php

From latest.xml to my_view.xml

From latest_item to my_view_item.php

 

In controllers/my_view.php did you change the VIEW from latest to my_view?

 

Around line 25 change

$view = &$this->getView('latest', 'html');

to

$view = &$this->getView(my_view, 'html');

 

You will most likely need to change the MODELs around line 27 & 31 too and then create your model(s).

 

What exactly are you trying to do?

 

Can't you just copy the view/latest/tmpl files to your template's html/com_k2/latest folder and make your changes there? Or do you need an actual new view?

Please Log in or Create an account to join the conversation.

  • Corinthian
  • Corinthian's Avatar Topic Author
  • Offline
  • New Member
More
13 years 9 months ago #91741 by Corinthian
Replied by Corinthian on topic Problems with creating new view for K2.
Thanks, Mike, the problem was in some unnecessary editing of view.html.php

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum