[fw-general] Can someone straighten me out on a best practices thing, possibly involving modules?

2008-10-03 Thread Ian Rickert

(pardon me if this went through twice, but I didn't see it appear in the
nabble forum after emailing it)

Hey there all --

I've been trying to understand ZF recently and I am having trouble wrapping
my mind around something.  I think it'll be easiest if I quickly explain how
I usually do things:

I run a website for a small alt-weekly and have come to think of pieces of
my layout as separate little "objects" with methods and properties.  I have
php classes like "articles","comments","guide" and "calendar" which
correspond to tables in a database, and which can execute logic based on
arguments given and return an HTML output string.  

So on any given page displaying, say, an article about turtles*, might be
comprised of objects which display the article itself, a list of related
articles, a box listing recent comments about the article, links to listings
in our town "guide" relevant to the article, relevant calendar listings,
etc., based on arguments passed through the URL to the controlling page, and
to the objects inside.

It seems like each of these objects sort of follows the controller/action
concept, if they were individual pages, rather than objects returning HTML. 
And I might want to use these same "objects" in different context on a
different section of the site, so I like having these php classes to turn
to, and I'm not duplicating the code.

Now... is that what "modules" are in Zend Framework?  Would it make sense to
turn my "articles", "comments" (etc.), my php classes into ZF modules?  They
certainly have their own structure, logic and actions.   Though I haven't
designed it that way originally, I could see how each could be divided into
an MVC pattern and I think I like it.

Now, if that is the case, how to I go about creating that master page?  I
suppose I could have a controller page and in actions for that page, make
calls to the various modules.  Like "/weekly/read/..." or
"/calendar/display/...", which would feed arguments to the modules, which
would return HTML; but is there an intended way to simply return the view's
HTML output, say, in a method of the module?  Where would I find that way? 
Or is it a bad idea?  I would love if someone could point me in the right
direction here... I'm having trouble with some of the terminology and not
positive where to focus my studies.  Maybe it's not modules at all.

Any help would be much appreciated, as I keep coming back to this same
issue.

Thanks in advance,
Ian R


*this is not a very realistic example, but seeing it now, I wish that it
were.
-- 
View this message in context: 
http://www.nabble.com/Can-someone-straighten-me-out-on-a-best-practices-thing%2C-possibly-involving-modules--tp19627695p19627695.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Zend_Dojo, styling dijits, overriding CSS

2008-10-03 Thread Ian Rickert



Matthew Weier O'Phinney-3 wrote:
> 
> -- Ian Rickert <[EMAIL PROTECTED]> wrote
> (on Friday, 03 October 2008, 09:39 AM -0700):
> 
>> I can't style the Dijits with CSS!  I understand
>> that there are CSS files which are loaded with the Dijits, and the common
>> answer is to override the settings either by changing the included files,
>> or
>> by using increased specificity in your css file.  I've also changed my
>> layout file so my custom CSS comes after Dojo is loaded and output.
> 
> 
> The best bet is to copy an existing theme CSS file and create your own
> module so you can create your own theme: --snip--
> 
> and start customizing from there. When you encounter images, you may
> need to copy these over to your new module so you can modify them.
> 
> You'll note that all the items are prefixed with .tundra -- change that
> to .awesome (or whatever you pick for your theme name). Then, just make
> sure that a container surrounding all your items has the class attribute
> set to "awesome", and you're good to go. (You have to do this whenever
> you use a theme, so get used to that aspect.)
> 
> 
> 


Wow!  Well, thanks for the quick response, Matthew.  Yowzers, though, that
sure is a lot of work just to change the width of a text input.  And what
happens when I want an exception to my custom style?  I guess I'll go with
the class selectors (or just not change the width!). 

Yes... now that I think about it, I *LOVE* the class selectors.  We doin'
this!

Ian
-- 
View this message in context: 
http://www.nabble.com/Zend_Dojo%2C-styling-dijits%2C-overriding-CSS-tp19801462p19802801.html
Sent from the Zend Framework mailing list archive at Nabble.com.



[fw-general] Zend_Dojo, styling dijits, overriding CSS

2008-10-03 Thread Ian Rickert

Hey all -- 

I'm hesitant to ask this because it is maybe a little bit more of a Dojo
question than a ZF question.  But I've had little luck with the Dojo docs
and my googlings for this have only created more confusion.

I'm very pleased with the construction of my dojo-enabled form -- once I
conformed my method of thinking to, you know, reality.

But now I'm stuck again -- I can't style the Dijits with CSS!  I understand
that there are CSS files which are loaded with the Dijits, and the common
answer is to override the settings either by changing the included files, or
by using increased specificity in your css file.  I've also changed my
layout file so my custom CSS comes after Dojo is loaded and output.

I'm trying to use selectors based on ID (can't really get more specific that
that!) and I've tried several variations of this:

#cal_Category{
width: 800px;
}

but to no avail.  The only success I've had is when I assign a class to my
Dijit, then I can write:

.WTFDojo{
width: 800px;
}

and that works okay with most things (some, like background-color, seem to
need to be !important) but I would really rather do things with ID selectors
in this case, and more than that I am curious as to why this doesn't work.

Has anyone else had issues like this?  I'd love a push in the right
direction.

Thanks,
Ian


-- 
View this message in context: 
http://www.nabble.com/Zend_Dojo%2C-styling-dijits%2C-overriding-CSS-tp19801462p19801462.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Using Layout & Views

2008-10-03 Thread Ian Rickert



Panman wrote:
> 
> Hi, want to start using ZF with a project and would like to properly use
> the layout and views. Just to note, this is in a non-MCV environment.
> 
> So from my understanding the first would be to create a layout for the
> overall design. Would I then make the header, footer, side nav, and
> content separate views? Also, what is the best setup to allow AJAX
> requests to the page? For example, I'd also like to have a login box in
> the header that would be AJAX enabled.
> 
> Thanks for any input!
> 

Hey there!  I found the Zend_Layout section of the manual to be helpful with
this.  I'm not 100% sure how to implement it in a non-MVC environment.  

As for creating separate views for each of those areas of your page, it
seems to me that you could do it that way with Zend_Layout, but if those
things do not change significantly from page to page, it might not be worth
it (again, I'm just starting out and don't know very well)... 

I haven't gotten into the AJAX side of things in ZF yet, but I suspect in
this case you'd want to create the DIV or whatever you'll be interacting
with in your view or layout, and then use Javascript to manipulate it from
there.

Anyone feel free to correct me on any point here, looking to learn.

Ian
-- 
View this message in context: 
http://www.nabble.com/Using-Layout---Views-tp19800314p19800615.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] How to validate Zend_Dojo_Form_Element_Textarea?

2008-09-26 Thread Ian Rickert



Bruno Friedmann-2 wrote:
> 
> 
> If you want to interact with the content of the textarea during the
> "client phase" you must interact with the browser and this
> is done by a javascript you could attach on the textarea.
> 
> Google is your friend
> something like this
> http://www.tutorialstream.com/tutorials/javascript/check-textarea-length/
> 
> 


You'll have to excuse me, but it seems to me that the
Zend_Dojo_Form_Elements are javascript-based Dijits, intended to validate on
the client-side.  I can easily (without Google, even) check a textarea's
length, but I was expecting the functionality of most of the other
Zend_Dojo_Form_Elements.  From Matthew's response, I'm not sure I'm mistaken
about that, but am I?

I've been scouring the ZF code and the Dojo API looking for clues as to why
this would or wouldn't work with a textarea, and I'll spare you the code
snippets, but it just seems like a (very strange) limitation of Dojo Dijits. 
There's no validate() function for dijit.form.Textarea the way there is for,
say, dijit.form.ValidationTextBox or dijit.form.ComboBox.  It is to weep. 
Kinda doesn't make sense to me, so if it actually does make sense, I'd love
to know why.

That having been said, I guess the way to go is to just put some custom
javascript in the oninit, onblue and onkeypress events of the textarea, like
Dojo has built in for those other Dijits.  Yes?

Ian



-- 
View this message in context: 
http://www.nabble.com/How-to-validate-Zend_Dojo_Form_Element_Textarea--tp19690291p19695957.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] How to validate Zend_Dojo_Form_Element_Textarea?

2008-09-26 Thread Ian Rickert


Matthew Weier O'Phinney-3 wrote:
> 
> 
> Just a note -- this will set a maximum of 5 characters, not 500, as you
> state you'd like to have.
> 
> 

Ah, yes.  Of course.  I had changed it to make testing easier, but forgot to
change it back for this post.



Matthew Weier O'Phinney-3 wrote:
> 
> 
>  Zend_Form validators are only called when the form is submitted;
> they do not affect client-side operations.
> 
> 

Ah... so is there a way to do it the way that ValidationTextBox does it,
with the alert symbol, turning yellow, displaying an error message?  So that
when the user exceeds 500 characters, it displays an error message?


Matthew Weier O'Phinney-3 wrote:
> 
> 
> Everything above looks correct; can you indicate what data passed to the
> form does not validate? That will potentially give me a reproduce case.
> 
> 

I'm a little unsure what you mean by this; I have basically been loading up
the page and then slapping a few random characters ("fdsagfdsa") into the
textarea, nothing fails validation (I believe because it doesn't actually
check)...


If it is related to the submit button, here's my code for that... perhaps
the problem is in there?

$el = new Zend_Dojo_Form_Element_SubmitButton("sb_SendForm2");
$el->setLabel("Submit??")
->setRequired();
$this->addElement($el);


Well, I've put what I have up on the web.  The textarea in question is
labeled "Describe the Event".  Also included are Zend_Debug dumps of the
Textarea and SubmitButton.

http://fairmountfair.com/CalendarSubmissions/public/

Thanks so much!  I really appreciate your work.

Ian



-- 
View this message in context: 
http://www.nabble.com/How-to-validate-Zend_Dojo_Form_Element_Textarea--tp19690291p19693452.html
Sent from the Zend Framework mailing list archive at Nabble.com.