I´m trying to follow this steps:
https://www.drupal.org/node/2025313
This is my first day in drupal and I have a problem in the first step =(
This:
Identify the file your theme function came from (theme.inc? a core/modules/color/?)
How I can find this "theme function"? I was looking for into a files of the project but I cand find this....
I get this project from other person and I can´t ask him "ey, where is the theme function?" Maybe I have wrong concepts and I don´t know where search...
Can someone help me?
Someone knows what I search? Is a funtcion? Is a file?
So the page you're looking at shows how to convert a tpl.php to a html.twig. This is showing you how to update a Drupal 7 theme to be compatible with Drupal 8.
Assuming that is in fact what you're trying to do, you will normally find Drupal 7 theme templates at sites/all/themes/YOUR_THEME_NAME/templates. Once you navigate there, you should see files ending in tpl.php. Inside these files you might find a theme function being used. You can identify them as they'll look something like function theme_YOUR_THEME_NAME_hook($variables).
What is a theme function?
A theme function is a PHP function that exists to provide HTML that is can be customized by themes and modules.
Here is the official list of theme functions. You can find a lot more information on Drupal.org, but here are a few starter links:
1. Theme API
2. Using the theme layer
3. Theme hooks
I would highly recommend reading a book on theming before tackling anything else. Drupal has a lot of depth, and if you're truly on day one and already converting themes, this will serve you well. I recommend 'Using Drupal' to understand the basics of Drupal, as a lot of Drupal development can be accomplished through the User Interface. Then move onto 'Drupal 7 Development by Example Beginner's Guide' to gain an understanding of how and when you should delve into actual code development.
Related
This Gutenberg update looks sweet, but it's immediately frustrating trying to follow any of the documentation.
I started with the very simple looking tutorial that is the first result on Google. It has code that looks to make sense for what I'm trying to do here. Great.
Except it says nothing about where to put this code to make it work.
Other tutorials are all about "download our plugin and we'll create one for you" - but I don't want to add that huge nest of code when what I'm really looking for is a fairly simple static block of code I can have users drop into a page.
Back in the day we'd just register a short code in the functions.php file and call it a day.
Can someone explain to me:
Where to put this registration code?
Where to put this JS code it references?
If I'm somehow going about this with a huge misunderstanding of how Gutenberg works?
Thanks
To actually solve this properly would need a couple of chapters of a book... but here's the very condensed answer.
Taking a very quick look at the link you shared, the code should be put in a plugin as there are calls to the function plugins_url(). So you need to first create a plugin. It's not difficult to build a simple plugin but it does take a bit of time getting used to how things need to be registered and how everything is glued together (that's why I said that a proper answer would take a couple of chapters of a book :D).
Once you have the plugin, the code should be within the plugin (or in any PHP file that is included by the plugin) and the JS file should go inside the plugin directory in a folder called step-01
There's a git repo from WordPress with some Gutenberg examples. I haven't looked to hard at them, but It might be a good idea to follow the code in there with the tutorial of how to build a plugin (and the WordPress code reference site opened too :D). If you are going to be developing things for WP, I recommend you to get Zeal or Dash to be able to browse the documentation in an easy and fast way.
Edit
I just found that you can create the scaffolding with wp cli. Wordpress has a tutorial on how to use the wp scaffold block command here.
My sister has a website running on Drupal which i have no experience at all in using. She now wants to edit the design of the frontpage and also so inner but i have no idea how to access the file like "index.html" in a non-Drupal platform.
It has adopted some kind of theme and module (which these two terms puzzled me enough).
May I know how to edit the layout and how to access to the requisite file? thank you...
You are not going to get an answer to your question. Your question is basically 'Tell me how drupal works'. Seems like to need to read up a little on how drupal theme layer works.
It also depends on which theme you are using.
Take a look at: http://drupal.org/node/171194
I really need help.
I have decided to build a website with drupal so that i can add drupal to my skills, but i am starting to think i have made a big mistake.
I am a wordpress developer and have built most off my websites with wordpress. The probalm i am have is custom templates with wordpress i can just create a custom temaplate by add some shortcode to the head off my theme file easy.
How do you do this with drupal is it completely modular can you adjust themes i am struggling trying to find a way off doing this. i started with drupal 6 and this was possible by doing the following.
page-node-17.tpl.php
i could just then assign this to the specific page with a node of 17, i have since switch to drupal 7 and this doesnt work.
Can someone please tell me if this is possible.
Thanks
Yes this is still completely possible, however, the naming convention changed. Now you will need to name it: page--node--17.tpl.php. For more information on naming templates, see Drupal 7 Template Suggestions. Also, the Theming Guide is a very useful resource.
I am a web Designer that recently decided to expand into developer waters as well :). What I have in mind is to build an elaborate portfolio site that will also contain a blog. The sites sections will be standard for such a project - something like Home, About, Portfolio, Contact and Blog.
The Home page will contain some static parts but also feeds from the latest additions to the portfolio and the blog.
The Portfolio page will have sections on the different types of portfolio pieces (like logo, print, web etc).
The About will be completely static.
The Contact page will be static and will have a contact form.
The Blog page will basically have your standard WordPress blog structure.
At first I was thinking of doing the whole thing in WordPress (since I already have some experience with it) but what got me thinking about different options was the portfolio part. I want the portfolio page to be quite differently stylized than the blog page and yet I want to have the possibility of doing quick and easy additions to it trough an admin panel.
So please give me suggestions and direction about what would be best for me to do? Is this thing possible with WordPress? Should I instead code the whole project with CodeIgniter (or a similar framework)?
I am quite good with HTML & CSS. Comfortable with jQuery. Trying to get better with PHP :).
I am willing to learn and improve and wouldn't mind trying a CMS or a Framework that Ive not had experience with before.
Thank you.
Wordpress is more than sufficient. You might want to find some plugins that allow you to add special content like videos, scripts and other things to portfolio pages. Also knowing html, css well is important if you want to build or modify a theme a lot to your liking. It is also very helpful to know some php if not be very experienced with it. MySql is helpful as well but not as need to know.
This Wordpress PHP function sheet is very helpful at times.
The Wordpress Codex page is also very good. Not an end all be all, you'll still need to know how to do things on your own, but it defiantly will get the ball rolling if want want any custom functions, or want to modify functions.
If you know wordpress a little bit, I hope you will able to make your desired project. Using wp you can do several types of project.
Read some wp books or tutorial and learn wp functions.
Essential wp functions sheet https://codex.wordpress.org/Function_Reference
I hope it will help you.
I am beginner to drupal and doesn't know more about it I am amazing about drupal theme works. And I would like know drupal theme's flow of execution. If i open theme folder..., there is a file like page.tpl, template.tpl,node.tpl and more... In which order the drupal reads all those theming file...
There is no easy answer, it really depends.
The thing with Drupal's theming system, is that it is very flexible, which means, that under certain situations you can make it use other templates, than the default.
The only thing you usually can be sure of, is that the page.tpl.php is used, it defines the main structure of the page. It usually defines different regions where you can put dynamic content. This content can be generated by a combination of templates and theme functions.
If you want to understand how this all works, you could try to read the theme guide, or for a more hands on approach, install the Theme developer module to inspect the different elements of a drupal page.
Nick Lewis, as always, has a well written piece about the theming internals here, here, and here. Not one of them gives you the complete overview, but the three of them together creates synergistic drupal awesomeness.