Use prism for code syntax highlighting
This commit is contained in:
parent
356c9dca43
commit
adf3c67355
54 changed files with 471 additions and 324 deletions
|
@ -11,19 +11,19 @@ I've called it 'Taxonomy', and it's similar to the original 'All Galleries' view
|
|||
|
||||
Within that file, I can remove the standard content output. This still outputs the heading information from the original View. I can now use the function called 'views_embed_view' to embed my taxonomy display onto the display. The views_embed_view function is as follows:
|
||||
|
||||
~~~php
|
||||
```language-php
|
||||
<?php views_embed_view('my_view', 'block_1', $arg1, $arg2); ?>
|
||||
~~~
|
||||
```
|
||||
|
||||
So, to display the galleries that are assigned the taxonomy of 'tournaments', I can use the following:
|
||||
|
||||
~~~php
|
||||
```language-php
|
||||
<?php print views_embed_view('photo_gallery', 'page_2', 'tournaments'); ?>
|
||||
~~~
|
||||
```
|
||||
|
||||
To reduce the amount of code needed, I can use the following 'while' loop to generate the same code for each taxonomy term. It dynamically retrieves the relevant taxonomy terms from the database, and uses each name as the argument for the view.
|
||||
|
||||
~~~php
|
||||
```language-php
|
||||
<?php
|
||||
$terms = db_query("SELECT * FROM {term_data} WHERE vid = 1");
|
||||
while ($term = db_fetch_array($terms)) {
|
||||
|
@ -31,4 +31,4 @@ while ($term = db_fetch_array($terms)) {
|
|||
print views_embed_view('gallery', 'page_2', $term['name']);
|
||||
}
|
||||
?>
|
||||
~~~
|
||||
```
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue