I'm working with Drupal and the book module right now, and it works perfectly for what I need.
The thing is, I need a way to print out a navigation similar to the one generated by the book block, but so that I can change what it outputs.
How do I print out a custom version of what the book block/book navigation prints out? For example, so that I can change the HTML output.
I hope this is clear enough, and please let me know if I need to add anything to make the question more clear.
Thanks in advance!
I don't exactly know how you want to modify that block, but you have several options.
If you don't need too big changes, probably it can be done with some CSS hacking
There are a few modules that do similar things, for instance Book Block or Advanced Book Block
Finally, you can always check out the book_block function, which prints the block and create a custom block with the necessary modifications
Related
I would really appreciate if anybody could help me with this question :)
I want to know whether it's possible to create your own semantic markup in PHP, just like BB Codes, but I want to be able to use it within my template engine system, so I could use it to call custom modules like voting system, adding comments, login form, registration form and so on...
Let me make it clearer for you guys of how I mean;
I'm working on my own CMS not to use it for production purposes but to learn PHP in a better way;
So I had this idea to call specific modules in a page based on their position and in order to be able to do;
For instance we're having a login module which is simply a login form, nothing too crazy, however you want to be able to include that module dynamically in any page you want using the backend and not touching any code;
So all you do in the template page is using my bb codes that I told you earlier;
Something like this;
Remember this is only an idea;
<zone name="left_sidebar"></zone>
And you add this zone markup on your sidebar and if any of your module supposed to be displayed on your left sidebar, it will just by having this markup and nothing more...
And you gone have loads of these semantic markups based on how many editable blocks you have on your page; so you could have one for the right sidebar, one for footer and one for header... etc.
So I now need to know how to could lookup for opening and closing tags, in this case it would be <zone></zone> , then it need to lookup for its attribute and its value, in this case name="right_sidevar"
....
Anybody have any idea of how I could possibly do this kind of thing...
Thanks in advance :)
You could check out TWIG; while it doesn't directly support this kind of feature (because it uses a special syntax for its own elements) it does have very good support for making your own elements, tags, sub-applications and other funky things in the backend.
http://twig.sensiolabs.org/
There are also a number of systems that perform this kind of task in the front-end; this would mean that the substitution is done by Javascript in the browser. In addition to the already mentioned Polymer, there's also Google's framework, Angular.
https://angularjs.org/
Maybe you can use php's libxml module to parse your xml file.
This question is addressed only to people having some experience in programming MediaWiki plugins.
I want to put some header at top of page with use plugin and html. I need to put some html code as the first tag after <body> opens to not but not know which hook or method should I use to achieve goal - Mediawiki has too much hooks to choose please suggest one.
http://www.mediawiki.org/wiki/Manual:Hooks
Result after plugin run should look like this:
<< Custom header>>
-----
<< Unchanged Mediawiki page >>
Could you help with this trivial problem?
One possible solution is to inject some JavaScript to create HTML but it is artificial and it will not work with Google Search Bot.
I think that many people want to put something on the top of their MediaWiki-s but without writing and maintain yet another skin or branching Mediawiki and it is supported today.
But if you think hooks is what you want, I'd go with ParserBeforeTidy. The hooks list is long but divided into sections, and "Page Rendering" is section you want to check. Parser(Before/After)Tidy are called on fully generated page, so they offer the highest degree of customization (which may be undesired, though).
I have a client who wants me to do CSS coding only, but doesn't want to give me the php files.
Right now, I just have access to the live website (with no CSS).
It is entirely made with tables and I want to use divs instead
I'm not sure if it is possible to do the coding
I thought about copying and pasting the generated HTML code from each page
Will this cause possible problems with the end result?
Yes, this will cause huge problems: you'll do an awesome job, client will have trouble integrating it with their site, client will abandon your awesome work.
IMO, you should let the client know that you'll do the best you can with what they have given you, but you would be able to save them a lot of work and do a better job if you could have access to the source code.
If you know that you can't make the client happy with what they have given you, though, it would be doing everyone a disservice for you to try.
If you absolutely can't convince them to give you access to the source, then this client sounds stupid:
He has a layout which is table based.
He wants you to magically make it look better with CSS, without having access to the source.
"#Phoenix I don't see any classes or IDs." - there are no classes or ids to hook into.
You might be able to do it if you used some CSS3 selectors to, for example, select the 3rd td inside a td inside the 2nd table to apply styles to ;)
But, that won't help if you have to support older browsers, which makes this impossible at the moment without doing something differently.
I don't have full knowledge of your situation, but here's what I would probably do (if I couldn't convince them to give me access to the source):
Open the live site.
Copy the HTML source code.
Paste it into a new local file.
Add this into the <head> section: <base href="http://the-clients-site.com/" />.
This will let all the assets on the page load from the client's actual site.
Now, you have something to work with.
You have to keep track of ALL changes you make to the file.
The first change should be adding your own blank style tag.
Then, you can add id and class to whichever elements you feel need it.
You should try to avoid moving around elements, unless it's absolutely required. Those changes are a whole lot harder to explain to someone. I know from experience.
You should be able to style the page properly now.
Then, you deliver the completed page, and the documented list of changes you had to make to the HTML (add id, here add class there).
The client should then be able to integrate the changes into his site.
Well, at a bare minimum they'll need to modify ther PHP to reference your CSS. More importantly, you need to be able to hook your CS up to elements - Do tables/rows/etc. have Ids or classes attached?
If they are clever and have some good separation between code and presentation (using a templating engine or similar) then you can probably just edit the template / css.
If they won't let you edit the PHP and you come up with a new awesome layout, they will have a nightmare job trying to integrate it and probably won't bother.
I don't see the problem. You can style tables just as easily as divs. You don't have to know how the wall is built to know how to paint it, which is pretty much all you've been hired to do. Only problem I could see would be if they haven't added any classes or ids to the elements yet. After all, what the browser/client sees is the only thing that needs styling, and since you can see everything that the browser sees, you can see everything that needs styling.
If they have added classes/ids, then just take a copy of a page and style it in a testing area, and then once it looks nice, you take a copy of another page and make sure it looks nice with it too, add to the CSS if there are any new unstyled elements that didn't exist on the first page, once it looks nice, then move on to another page, and another repeating the process until you are satisfied that it appears that every page within reason would look nice with it.
If they haven't added classes/ids, tell them they need to in some capacity before you can work on it, perhaps provide some guidance on the issue.
I'm actually doing this right now for SO.
I'm working on a userscript that provides an alternate "clean" stylesheet for the StackExchange network. I have no access to the SO engine. I am using the Chrome Inspector to look at how the elements are set up. I recommend the same. (Although it is a little different, since I'm modifying the original CSS file.)
You can easily identify what you want to style with the Inspector and then work from there. I would suggest that you ask your client for a list of classes and IDs though. (I got that in the form of an existing stylesheet, you can go about it in a different way, if that suits you and your client.)
I currently have a load of attributes already setup as text boxes - is there anyway I can get them appearing within the layered nav?
Any help would be much appreciated.
Regards
Shane
Given what you are looking for, Magento does not support what you want by default. However, the Magento filter code is fairly well structured, so this is something that you could add at will. The relevant backend code that will need to be modified is in the Catalog/Model/Layer subdirectory. Specifically, you will need to edit Mage_Catalog_Model_Layer to accommodate your new code. Also, you'll need to add a class that implements Mage_Catalog_Model_Layer_Filter_Abstract, to handle the actual filtering code. Finally, you will need to make the options appear on the frontend, which (in my cursory examination) will require two major changes. Firstly, you'll need to change the backend to allow the admin to mark text fields as being filterable, after which you'll need to modify the frontend template to display the checkbox fields.
This is a really significant amount of work. If at all possible, I'd recommend avoiding this route as it will also probably cause you significant problems down the road.
Hope that helps!
Thanks,
Joe
Right for anybody else looking at this, I looked into going down the custom code route, but quickly back tracked...
I decieded to bit the bullet, delete my attributes and recreate them and import the products again.
I'm developing a theme for a Drupal blog; the mock-up I created requires the post content, trackbacks block and comments block to appear in a central column, with borders running either side.
I've got the CSS and HTML working correctly, so that's not the issue here. My problem is that the comments block as generated by Drupal is placed outside of the div defining the central column, and so it appears out-of-place. As such, I think the solution is to stick a line into my theme saying "print column block here", but having scoured the Drupal docs I can't see any way to do so. Based on the HTML output by Drupal, I'm not sure a CSS/HTML fix is going to work.
I'm sure other Drupal theme developers must have come up against this before...
In the node.tpl.php you can create the html for the node's full display (the node is being viewed). You can create templates for each node type, fx node-blog.tpl.php etc. The default node template just prints $content, but if you want, to can instead print the each item separately with the desired markup.
This is less dynamic, as you would need to add new items if they were added to the node, but it does give you more fine grained control over the markup. This is the most simple solution I can think of.
To place the comments use this snippet:
<?php print comment_render($node); ?>
or lookup the comment_render() function
There are several ways to address this in Drupal 6.
Using something like the comment_display module, you can manually place the comments anywhere in your page.tpl.php file.
Alternatively, you can do something similar using panels.
I eventually managed to resolve this using an HTML and CSS fix after all. It's not as seamless as I'd like, but it's not the end of the world.
Thanks for the suggestions, I hadn't anticipated that things like comments would be output as part of the node content!